第一个c++程序

 

001、

[root@pc1 test01]# ls
test.cpp
[root@pc1 test01]# cat test.cpp    ## 第一个c++程序
#include <iostream>
using namespace std;

int main()
{
        cout << "hello world!" << endl;

        return 0;
}
[root@pc1 test01]# g++ test.cpp   ## 编译
[root@pc1 test01]# ls             ## 查看编译结果
a.out  test.cpp
[root@pc1 test01]# ./a.out        ## 执行可执行程序
hello world!

 

 

posted @ 2023-10-26 15:43  小鲨鱼2018  阅读(8)  评论(0编辑  收藏  举报