1.2 第一个C++程序

编写一个C++程序总共分为4个步骤

  • 创建项目

  • 创建文件

  • 编写代码

  • 运行程序

1.1.1 创建项目

Visual Studio是用来编写C++程序的主要工具,先将它打开

【创建新项目】-->【Visual C++】-->【空项目 】,填写项目名称以及选择位置,点击【确定】

1.1.2 创建文件

右击【源文件】-->【添加】-->【新建项】-->【Visual C++】-->【C++文件(.cpp)】,填写名称 以及选择位置,点击【添加】

1.1.3 编写代码

#include <iostream>
using namespace std;

int main()
{
	cout << "hello world" << endl;
	system("pause");
	return 0;
}

1.1.4 运行程序

最后更新于

这有帮助吗?