-
-
Save anonymous/5a66860c13eb8361b1aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
const int ORDER = 4; | |
void fill (int m[], int order); | |
void outputMatrix (int m[], int order); | |
int main(){ | |
int matrix[ORDER]; | |
int row; | |
int column; | |
int n; | |
fill (matrix, ORDER); | |
outputMatrix (matrix, ORDER); | |
do { | |
cout << "Enter the number to place, the row and the column, each seperated by a space: "; | |
cin >> n; | |
cin >> row; | |
cin >> column; | |
}while (n != 0 || n <= ORDER); | |
if (n == 0 || n > ORDER){ | |
cout << "Thank you"; | |
cout << endl; | |
} | |
return 0; | |
} | |
void fill (int m[], int order){ | |
for (int i = 0; i < order*order; i++){ | |
m[i] = 0; | |
} | |
} | |
void outputMatrix (int m[], int order){ | |
int c = 0; | |
for (int i = 0; i < order*order; i++){ | |
c++; | |
cout << m[i] << ' '; | |
if (c == order){ | |
cout << endl; | |
c = 0; | |
} | |
} | |
cout << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment