First, completely read and understand the assignment. The 2D array must be a parameter passed to the various functions. Declaring it in global space is not fulfilling the assignment and is, in general, not a good thing to do in programming classes, or real life programming.
The array must be declared inside main( ). Your functions must take that, and other information as parameters. In particular, I recommend you pass the number of rows to the functions, so they may be used with arrays of any number of rows. (They will be constrained to column dimension of 9.)
Generally, your functions are set up to do the jobs specified.
randnum( ) need only be called once in main( ), not inside the loop. The function is looping through the array, filling all elements, so you don't need to call it 90 times! What is the purpose of the one value you're returning from randnum( )? It's role is just to fill the array, not give any results back.
If you're confused about passing arrays to functions, here's a quick sample
int main( )
{
int data[3][4] = { 1,2,3,4, 5,6,7,8, 9,10, 11, 12 };
int total;
total = sum( data, 3 );
cout << total << endl;
return 0;
}
int sum( int d[][4], int nrows )
{
int i, j;
int result = 0;
for( i = 0; i < nrows; i++ ) //rows
for( j = 0; j < 4; j++ ) //columns
result += d[i][j];
return result;
}
Please use the code tags around your code in future postings, like:
[code]
your code goes here
[/code]