A couple of questions concerning arrays
First of all, thanks for all those who have helped me in the past and those who are about to.
I only have my prog written for the first part of my Q, the 2nd part, i need help setting up.
1) How do i store the numbers in a 5 x 3 array called Data[5][3]. I can have the user input data in the following prog, but how do i specifically call it "Data [5][3]. The reason I need to know this is becuase:
2) I need to have the program pass the array Data[ ][ ] from main ( ) to a function. My prof told me to use, float mean (const int Data [ ][ ], int, int ). I think it should look something like, mean (Data [ ][ ], 5, 3)
heres my prog
Code:
#include <iostream>
#include <iomanip>
using namespace std;
const int numrow = 5;
const int numcol = 3;
int main ()
{
double data[numrow][numcol];
for (int i = 0; i <numrow; i++)
{
for (int j = 0; j < numcol; j++)
{
cout << "enter grades for row # " << (i + 1)<< ": ";
cin >> data [i][j];
}
}
for (int a = 0; a < numrow; a++)
{
for (int b = 0; b < numcol; b++)
{
cout << setw (4) << data [a][b];
}
cout << endl;
}
return 0;
}