I'm having trouble understanding why my array of vectors is not inputting a line. ...
#include<bits/stdc++.h>
using namespace std;
int main () {
int r;
cin>>r;
vector <int> v[r];
for (int i=0; i<r; i++) {
for (int j=0; j<i; j++) {
int x;
cin>>x;
v[i].push_back(x);
}
}
for (int i=0; i<r; i++) {
for (size_t j=0; j<v[i].size(); j++){
cout<<v[i][j];
}
cout<<endl;
}
}
... With input ...
5
7
3 8
8 1 0
2 7 4 4
4 5 2 6 5
... it outputs ...
7
38
810
2744
... with an empty line in the beginning of the output.