一. 一个标准的C++代码拆分
- Hello world程序代码
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
运行结果:
(1)#include <iostream
- 以#开头的语句称为预处理器指令,需要放在程序开头
- 将iostream文件的内容添加到程序中,iostream文件中包含了有关输入输出语句的函数(input & output ,stream:流)
(2)using namespace std
- 使用命名空间std(如cout隶属于命名空间std。避免名称冲突)
(3)