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);
}
The expert did excellent work as usual and was extremely helpful for me.
"Assignmentexpert.com" has experienced experts and professional in the market. Thanks.
Comments