i don't know how take input like the following code
1 4 3 2 9 7 18 22 0
2 4 8 10 0
7 5 11 13 1 3 0
-1
each line finished when take zero
and finished taking input when take -1
Do this code is right for this task ?
int n;
vector<vector<int> >v;
while(cin>>n && n!=-1){
vector<int>temp;
if(n!=0){
temp.push_back(n);
}
v.push_back(temp);
}
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment