so this is my goal im trying to create 3 matrix functions, but i am also trying to create another function that shows the numbers of each matrix.

when I run my code it does what i want

but it only outputs one grid

(matrix1 im guessing) and the its a mess of numbers.

im trying to achieve inputting all the numbers for each matrix and then i want the program to show me the results of each matrix.here is my code so far:

Code:using namespace std; int matrix1(); int matrix2(); int matrix3(); void result(); int main() { matrix1(); matrix2(); matrix3(); result(); system("pause"); return 0; } int matrix1() { int row,column; int arr[3][3]; cout << endl; cout << "matrix1" << endl; for (row = 0; row < 3; row++) for (column = 0; column < 3; column++) { std::cout << "ENTER NUMBER " << (column + 1) + 3 * (row) << " : "; std::cin >> arr[row][column]; } return 0; } int matrix2() { int row,column; int arr[3][3]; cout << endl; cout << "matrix2" << endl; for (row = 0; row < 3; row++) for (column = 0; column < 3; column++) { std::cout << "ENTER NUMBER " << (column + 1) + 3 * (row) << " : "; std::cin >> arr[row][column]; } return 0; } int matrix3() { int row,column; int arr[3][3]; cout << endl; cout << "matrix3" << endl; for (row = 0; row < 3; row++) for (column = 0; column < 3; column++) { std::cout << "ENTER NUMBER " << (column + 1) + 3 * (row) << " : "; std::cin >> arr[row][column]; } return 0; } void result() { int row, column; int arr[3][3]; for (row = 0; row < 3; row++) { for (column = 0; column < 3; column++) { std::cout << arr[row][column] << " "; } std::cout << std::endl; } std::cout << "\n\nand here you have a matrix\n"; }

Tweet This+ 1 thisPost To Linkedin