c++输入任意个数以空格隔开的字符串

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 
 4 //此代码顺带实现了一些特别功能
 5 int main()
 6 {
 7     string in, out;
 8 
 9     cin>>out;
10     while (cin>>in && getchar()!='
')
11     {
12         out = in + " " + out;
13     }
14     out = in + " " + out;
15 
16     cout<<out<<endl;
17 
18     return 0;
19 }
原文地址:https://www.cnblogs.com/hemeiwolong/p/12454674.html