<span style="font-family: Arial, Helvetica, sans-serif;">#include <iostream></span>#include <string>
using namespace std;
int main()
{
string line;
while (getline(cin, line))
{
cout << line << endl;
}
system("pause");
return 0;
}
本文介绍了一个简单的C++程序,该程序使用标准输入输出库来读取用户的输入,并将其原样输出到屏幕上。通过使用getline函数,程序能够读取包含空格的整行文本。
<span style="font-family: Arial, Helvetica, sans-serif;">#include <iostream></span>#include <string>
using namespace std;
int main()
{
string line;
while (getline(cin, line))
{
cout << line << endl;
}
system("pause");
return 0;
}
2629
528

被折叠的 条评论
为什么被折叠?