0 使用Visual Studio创建C++项目输出Hello world
编写一个C++程序总共分为4个步骤
- 创建项目
- 创建文件
- 编写代码
- 运行程序
0.1 创建项目
Visual Studio是用来编写C++程序的主要工具,先将它打开:
创建新项目:
0.2 创建文件
右键源文件,选择添加 >> 新建项
选择C++文件,给C++文件起个名称,然后点击添加:
0.3 编写代码
#include<iostream>
using namespace std;
int main() {
cout << "Hello world" << endl;
system("pause");
return 0;
}
0.4 运行程序
运行程序,命令行会输出运行结果: