我正在接受 20 行输入。我想用空格分隔每行的内容并将其放入向量的向量中。如何制作向量的向量?我很难把它推回去......
我的输入文件:
Mary had a little lamb
lalala up the hill
the sun is up
矢量应该看起来像这样。
ROW 0: {"Mary","had", "a","little","lamb"}
ROW 1: {"lalala","up","the","hill"}
这是我的代码....
string line;
vector <vector<string> > big;
string buf;
for (int i = 0; i < 20; i++){
getline(cin, line);
stringstream ss(line);
while (ss >> buf){
(big[i]).push_back(buf);
}
}