1、控制台输入输出流
不同的系统或平台有自己的控制台,输入输出流与具体的平台有关,标准库std里定义了三个流,cout标准输出流,cin标准输入流和cerr标准错误流。
2、命名空间
命名空间是为了解决命名冲突的问题。
3、注释
C++中除了可以使用//和/*...*/来注释外,还可以使用宏定义#if 0 ... #endif来进行多行注释。
#include <iostream>
using namespace std;
namespace One{
int a=10;
int b=20;
}
namespace Two{
int a=10;
int c=30;
}
int main(int argc,char** argv){
cout << "helloWorld!" << endl;
using One::a;
cout << a << endl;
a=-10;
cout << a << endl;
cout << Two::a << endl;
Two::a*=2;
cout << "Two a=" << Two::a << ",c=" << Two::c << endl;
return 0;
}
#if 0
int test(){
cout << "a+b=" << 10 << endl;
for(int i=0;i<100;i++){
cout << i << endl;
}
}
#endif