Finding a number in a matrix - homework question

Hi everybody! Sorry for my bad english! I have a matrix of integers with a maximum length 6 digits. I must to write
program, that checks whether a number is found in the section above the main secondary
diagonal of this matrix.
I'm beginner in C + + and I know, how to write a two-dimensional array, who will be our matrix. So, our matrix must be a square matrix that means the numbers of the rows and columns must be equals. I found one code, like this task: http://www.dreamincode.net/code/snippet594.htm This source code is to input a square matrix and to display the elements on and above the diagonal of the matrix. Can i make a little changes in this source code to write my homework... :) I know that this information here is very little and if you can't help me for this task or if you don't want, will back with more information tomorrow.
I hope you realize we won't do it for you. After you've made the changes you're thinking of, trying running it yourself then come to us with specific problems you are having and we can try to help.
I think that i have done something...


#include <iostream>
using namespace std;

// Define maximum size of the matrix
#define MAXN 6
int a[MAXN][MAXN];

int main()
{
// Boolean variable that will looking for the number
bool flag = 0;
int n, equal=1, number;

// Here i will input the size of the matrix
cin >> n;

// Input values of the matrix
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
cin >> a[i][j];
cin >>number;
// Start crawling above the secondary diagonal
for(int i=0; i<n-1; i++)
{
for(int j=i; j<n; j++)
{
// Perform the search for the number
if(a[i][j] == number) flag = 1;
break;
}
if(flag) break;
}
if(flag == 1) cout << "Yes!" << endl;
else cout << "No!" << endl;
system("pause");
return 0;
}

So, i think that in the beginning i must to insert a max value 6 for the matrix, because a statement of the problem is a matrix with 6 rows and 6 columns? Am i right for this? And i have a question in the part with the size of matrix, why to insert a size when i give a maximum value for this matrix. I'm tired, in all day of searching for something like my problem but the most similar, in the net is this source code who I managed to gather from the fragments and books for C++. Please help me.
Topic archived. No new replies allowed.