Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int SIZE = 3;
- bool equalMatrix(int matrix[SIZE][SIZE]);
- void main()
- {
- int matrix[SIZE][SIZE], i = 0, j = 0, result = 0;
- bool isEqualMatrix = true;
- cout << "please enter " << SIZE << " * " << SIZE << endl;
- for (i = 0; i < SIZE; i++)
- {
- for (j = 0; j < SIZE; j++)
- cin >> matrix[i][j];
- }
- result = equalMatrix(matrix);
- cout << "your matrix is " << result << endl;
- system("pause");
- }
- bool equalMatrix(int matrix[][SIZE])
- {
- int i = 0, j = 0, sum = 0;
- for (i = 0; i < SIZE; i++)
- {
- sum = 0;
- for (j = 0; j < SIZE; j++)
- {
- sum += matrix[i][j];
- }
- for (j = 0; j < SIZE; i++)
- {
- sum -= matrix[j][i];
- }
- if (sum != 0)
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment