0

Hi,

I've been working on this a few days and I'm kinda stuck. my error is in line 38-

```
average =ave(&ParentsAge,sizeof(ParentsAge));
```

If anyone has any ideas as to what I am doing wrong, I would love to finally figure this out!! Thanks

```
#include <iostream>
using namespace std;
void displayTitle ()
{
cout << "Calculate the Average Age of Parents seeking Invetro" << endl;
}
double ave (int *array, int asize)
{
double average;
double sum;
for (int i = 0; i < asize; i++)
{
sum += array[i];
}
average=sum/asize;
return ( average );
}
int main ()
{
displayTitle ();
double ParentsAge[10], age1, average; //declaring array as integer
int i, sum; //declaring age1 sum and integer
sum = 0;
for (int i = 0; i < 10; i++) //for loop to keep count
{
cout << "Enter 10 parents age: " << ( i + 1 ) << endl;
cin >> age1; //input of ages
if (age1 != 0) {
ParentsAge[i] =age1; //adding ages together
}
else {
(age1 == 0);
cout << "Enter a valid age" << endl;
i--;
}
}
average =ave(&ParentsAge,sizeof(ParentsAge));
cout << endl ;
cout << "Average age of Parents seeking Invetro is: "<< average << endl; //output of averages
return (0);
}
```

*Edited
by mike_2000_17*: Fixed formatting