#include<iostream>
//#include<string>
using namespace std;
int main()
{
string user_name;
cout<<"please enter your name:";
cin>>user_name;
cout<<"\n"<<"hello,"<<user_name<<",goodbye.\n";
while(1);
return 0;
}
用于实现存储用户输入的文字。
可能string已经在标准命名空间里,所以可以直接用来初始化,不需要头文件了。
ps:某些IDE总是需要加while(1)。