这程序为什么要输入ctrl+z,才能正常输出结果,若不输入ctrl+z,怎样才能正常输出结果?
#include<iostream>#include<string>usingnamespacestd;intmain(void){stringresult_str,st...
#include<iostream>
#include< string>
using namespace std;
int main(void)
{
string result_str, str;
cout << "Enter strings(ctrl + z to end): " << endl;
while(cin >> str)
{
result_str = result_str + str;
}
cout << "string equal to the concatenation of these strings is:" << endl << result_str<< endl;
return 0;
} 展开
#include< string>
using namespace std;
int main(void)
{
string result_str, str;
cout << "Enter strings(ctrl + z to end): " << endl;
while(cin >> str)
{
result_str = result_str + str;
}
cout << "string equal to the concatenation of these strings is:" << endl << result_str<< endl;
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询