mean() is a function, like main. It must be out of the { and } of the main function. Main returns an int. Use std:: before cout. or put "using namespace std;" under the includes. Format your code. iostream.h is outdated, use iostream. It's a weird code, what is the "Size" variable? What's that "X" array?
Code:
#include <iostream>
using namespace std;
float mean(float A[], int Size);
int main()
{
float myArray[100];
int last, i;
for (i=0; i < 99; i++) // i = i + 1 is the same as i++
{
mean(myArray, i) // what variable is "Size"?
}
last =i-1;
for (i=0; i <= last; i++)
{
cout << X[i] << " "; // don't quote around variables
} //end loop
return 0;
}
float mean (float A[], int Size) // what variable is Size?
{
float m;
float sum = 0;
for (int i=0; i < Size; i++) // wrong semi-colon,
{
sum = sum + A[i];
}
m = sum/Size;
return m;
}