I want to create a program that create N matrix due the user input, but i need to return the vector(or array) values and then send them to a function, and again, get by return a vector.
For example:
vector<int> createMatrix(rows, cols){
for(int x = 0; x < rows; x++){
for(int y = 0; y < cols; y++){
cout << "Please, input the values for the row " << x << " and col " << y << endl;
vector<int> Matrix(...)values;
cin >> (...);
}
}
return Matrix; //here is the point
}
vector<int> mathOperations(operation, matrixA, matrixB){
(...)
return vector<int> resultMatrix;
}
int main(int argc, char *argv[]){
int nMatrix, nRows, nCols;
cout << "Please, answer how many matrix would you like do be created?" << endl;
cin >> nMatrix;
cout << "Thank you, and how many rows your matrix will have?" << endl;
cin >> nRows;
cout << "Thank you again, and how many cols?" << endl;
cin >> nCols;
cout << "Okey, creating " << nMatrix << " nMatrix for you!" << endl;
for(int n = 0; n < nMatrix; n++){
cout << "Please, insert the values for the matrix no" << n+1 << endl;
vector<int> myMatrix[n] = createMatrix(nRows, nCols);
}
/* the rest of my code with functions to print values, create a new vectors by math operations between given arguments
*/
return 0;
}
What is the best way to do this?