一个很简单
C++
的程序
: hello.cpp
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world" << endl;
return 0;
}
运行环境
:linux
编译
: g++ hello.cpp -o hello
或者
gcc hello.cpp -o hello -lstdc++
注意
:
1.
扩展名为
cpp,
用
c
也可以
,
既然是
c++,
最好用
cpp
2.
必须使用名字空间
:using namespace std;
3.
编译命令
,gcc
编译请用
-lstdc++
4.
很简单的程序
,
在此载跟头的人很多
,
如下
: