第一次用VS来编写代码
第一次用VS来编写代码,步骤:
1、新建一个空项目,从模板中单击VisualC++,再单击空项目,并在名称中转入程序名后按确定;
2、鼠标指向源文件后右击,然后添加,然后单击新建项或Ctrl+Shift+A
3、单击C++文件(.cpp),输入名称,然后点击确定
4、出现编写代码区,于是在其上编写一段如下的代码:
#include<iostream>
voidsimple();//functionprototype
intmain()
{
usingnamespacestd;
cout<<"main()willcallthesimpke()function:\n";
simple();//functioncall
return0;
}
//functiondefinition
voidsimple()
{
usingnamespacestd;
cout<<"I'mbutasimplefunction.\n";
}
5、然后按F5运行。弹出如下图: