001. cpp primer快速入门

最简单的c++程序:

#include<iostream>
using namespace std;
int main()
{
    cout << "hello,world!" << endl;
    system("pause"); 
    return 0;
}

注解:cout定义在头文件中iostream中。cout相当于计算机的screen,相当于把“hello,world!”丢给计算机的屏幕。

运行结果:

#include<iostream>
using namespace std;
int main()
{
    //cout << "hello,world!" << endl;
    system("pause"); 
    return 0;
}

 0返回给谁呢?返回给windows,告诉windows,我的程序正常运行,正常结束了。

猜你喜欢

转载自www.cnblogs.com/yibeimingyue/p/13379919.html
cpp