I am trying to create a 2-D vector that as column 0 it would have integers and column 1 would have vectors.
For example:
column[0] column[1]
2 {2}
5 {1,2,0}
12 {4,7,9,0,0,1,6,0,0}
3 {6}
column 0 would be user input while column 1 I will calculate it on my own – I don’t mind if it has dummy vectors for now and after the user exits then it would print the 2-D vector.
What I tried is:
int main() {
unsigned int input;
vector<vector<unsigned int>> v;
while (cin >> input) // enter non int to exit
for(int i=0; i<input;i++){
vector<int> factorial; //calc in a separate function - dummy vector for now
for (int j=0; j<factorial.size(); j++){
v[i].push_back(input); //set column 0 as input
v[i][j].push_back(factorial); //set column 1 as the vector containing the factorial of input
}
}
return 0;
}
Source: Windows Questions C++