64,648
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
vector<string> svec;
string str;
cout << "请输入若干个字符串,回车键结束:" << endl;
while (cin >> str)
{
svec.push_back(str);
}
/*cout << "你好,世界!" << endl;
vector<string>::iterator ibegin = svec.begin();
vector<string>::iterator iend = svec.end();
while (ibegin!=iend)
{
cout << *ibegin << endl;
++ibegin;
}
cout << svec.size() << endl;*/
for (vector<string>::iterator iter = svec.begin(); iter != svec.end(); ++iter)
{
cout << *iter << endl;
}
system("pause");
return 0;
}