当前位置:软件学习 > Word >>

c++ HelloWord

[html] 
#include <iostream> 
using namespace std; 
 
int main() 

    string str; 
        cout << "plase enter you name\n"; 
        cin >> str; 
        cout << "Hello, " << str << "!\n";  

运行输出:
[html] 
pateo@pateo-B86N53X:~/work/study$ g++ -o hello test.cpp 
pateo@pateo-B86N53X:~/work/study$ ls 
hello  main  main.c  test.cpp 
pateo@pateo-B86N53X:~/work/study$ ./hello 
plase enter you name 
liaojianguo 
Hello, liaojianguo! 

补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,