Hey, so for our c++ class, we are asked to ask the user to create a matrix.. they'll input the number of rows/columns. Then they'll input the values into each row and column.
typedef vector<int> vd;
typedef vector<vd> x;
x Matrix;
int rows, columns;
int val1, val2;
cout << "Please enter the number of rows in your matrix: " << endl;
cin >> rows;
Matrix.resize(r ows);
I have this so far.. and I have an idea that I'm supposed to (or should) use for loops to get the input as to how man rows/columns they have. i'm just not entirely sure how to go about it.
for(val1=0; val1<= rows; val1++)
for(val2=0; val2<= columns; val2++)
i'm think something like this, but i'm confused as to how to ask the user how many rows/columns they want and then how to put that in?
typedef vector<int> vd;
typedef vector<vd> x;
x Matrix;
int rows, columns;
int val1, val2;
cout << "Please enter the number of rows in your matrix: " << endl;
cin >> rows;
Matrix.resize(r ows);
I have this so far.. and I have an idea that I'm supposed to (or should) use for loops to get the input as to how man rows/columns they have. i'm just not entirely sure how to go about it.
for(val1=0; val1<= rows; val1++)
for(val2=0; val2<= columns; val2++)
i'm think something like this, but i'm confused as to how to ask the user how many rows/columns they want and then how to put that in?
Comment