I\'m having some issues passing vectors to functions. My concern is not with my logic itself, as if I need to adjust later I will. My program requirements state that I must
You never add the elements to the matrices, ie. matrix
and matrix2
are empty when you call build. You need to size the matrix after your receive the users input.
void build(){
//currently intended just to build 2x matrices of different increasing data
int k=0, l=5;
cout<<"Enter the number of rows for each Matrix: "<>row;
cout<<"Enter the number of columns for each Matrix: "<>col;
matrix.resize(row);
matrix2.resize(row);
for( int i = 0; i < row; i++ ) {
matrix[i].resize(col, 0);
matrix2[i].resize(col, 0);
for ( int j = 0; j < col; j++ ){
matrix[i][j] = k++;
matrix2[i][j] = l++;
}
}