技术交流QQ群:1027579432,欢迎你的加入!
#include <iostream> #include <vector> using namespace std; int main(){ int x = 0; vector<vector<int>> vec; vector<int> v; while(cin >> x){ v.push_back(x); if(cin.get() == '\n'){ vec.push_back(v); v.clear(); } if(cin.peek() == '\n'){ vec.push_back(v); break; } } cout << "row:" << vec.size() << endl; cout << "col:" << v.size() << endl; cout << "验证输出\n"; for(int i = 0; i < vec.size(); i++){ for(int j = 0; j < v.size(); j++){ cout << vec[i][j] << " "; } } return 0; }