Hello,

I am in an entry level C++ course. We have a homework problem that requires us to prompt the user to enter five sets of three numbers (type double) and store the numbers in a 5 x 3 array called `Data[5][3]`

. Then, pass the matrix `Data[5 ][3 ]`

from `main ( )`

to a function float mean `(const int Data [ ][ ], int, int )`

that receives the array `Data [5 ][3 ]`

and its dimensions as arguments to find the row and column mean of matrix Data and prints the results in function `main ( )`

. Here is a copy of my syntax:

```
#include <iostream>
#include <iomanip>
using namespace std;
float mean(const double, int, int);
int main()
{
const int row=2, col=3;
double data[row][col];
float avgrows[5];
//Entering values for the matrix
cout<<"Enter two sets of three number."<<endl;
for(int i=0; i<row; i++)
{
for(int j=0; j<col; j++)
{
cout<<"Enter row "<<i+1<<": ";
cin>>data[0]>>data[1]<<data[2];
}
}
//Stores row means into an array
for(i=0; i<row; i++ )
{
avgrows=mean(data, row, col);
}
//Print array
for(int x=0; x<5; x++)
{
cout<<avgrows[x]<<" ";
}
return 0;
}
float mean (const double data, int rows, int columns)
{
float average, sum=0;
for(int i=0; i<rows; i++)
{
for(int j=0; j<columns; j++)
{
sum+=data[j];
}
average=sum/columns;
return average;
}
}
```

Once I compile this cpp file, I get 4 errors, they are:

```
--------------------Configuration: matrix passing - Win32 Debug--------------------
Compiling...
matrix passing.cpp
1.) error C2676: binary '<<' : 'class std::basic_istream<char,struct std::char_traits<char> >' does not define this operator or a conversion to a type acceptable to the predefined operator
2.)error C2664: 'mean' : cannot convert parameter 1 from 'double [2][3]' to 'const double' There is no context in which this conversion is possible
3.) error C2109: subscript requires array or pointer type
4.) error C2109: subscript requires array or pointer type
Error executing cl.exe.
matrix passing.exe - 4 error(s), 0 warning(s)
```

I can't figure what the error mean, nor can I figure out what else to do. I've been racking my brain the last couple of days. If some one could shine some light on this matter, I would greatly appreciate it. I've also attached a copy of my cpp file.

Thank you.

*Edited 3 Years Ago by happygeek*: fixed formatting