阿神2017-04-17 14:44:19
#include <sstream>
#include <string>
#include <vector>
std::string line, num;
std::vector<std::vector<int>> v;
size_t linenum = 0;
while (getline(cin, line)) {
std::istringstream iss(line);
while (line >> num) {
v.push_back(vector<int>());
v[linenum].push_back(stoi(num));
}
++linenum;
}
I just finished reading C++ primer, and this is probably the approach.
怪我咯2017-04-17 14:44:19
You are doing a question on OJ. If it is OJ, the required input is actually different from what you understand. You can refer to this
http://blog.csdn.net/sxheliji...