I'm attempting to get the dimensions of a 2D matrix as an input. Then utilize user input to fill in the blanks in this matrix. I attempted to accomplish this using vectors (vectors of vectors). However, anytime I try to read in data and append it to the matrix, I get problems.
//cin>>CC; cin>>RR; already done
vector<vector<int> > matrix;
for(int i = 0; i<RR; i++)
{
for(int j = 0; j<CC; j++)
{
cout<<"Enter the number for Matrix 1";
cin>>matrix[i][j];
}
}
I get a subscript out of range error whenever I try to execute this.
Do you have any suggestions?