Arrays: mean, largest value, function count,

This is a discussion on Arrays: mean, largest value, function count, within the C++ Programming forums, part of the General Programming Boards category; Hi everyone, I need a bit of help in this assignment I need to hand in for university. Can anyone ...

Arrays: mean, largest value, function count,

Hi everyone, I need a bit of help in this assignment I need to hand in for university. Can anyone help me? here is the problem:-

"Read a program that will read in a file of integers into an array. Hence, writing your own functions, compute their mean, the largest value, and a function count to count how many times an integer occurs int he data. Output your results to a file aswell as the screen."

*Apparently these arays must also be read from a text file*

If anyone has any ideas I will be very greatful for your comments and help.

I know that something like this should be in it (I wrote most of this down, my lecturer edited it for me), but can anyone by any chance give me the codes to help complete this assignment.

PHP Code:

#include <iostream.h>

void main()

{

float myArray[100];
int last, i;

for (i=0; i<=99; i=i+1)

{

float mean (float A[],int Size) ***********************

{

float mean;
float sum = 0;
for (int i=0; i < Size; i=i+1);

{
sum = sum + A[i];

} //end loop

mean = sum/(Size);
return mean;

}//end loop +++++++++++++++++

} //end loop

last =i-1;

for (i=0; i<=last; i=i+1)

{

cout << "X[i]" << " ";

} //end loop

}//end main

A quote my lecturer sent me through his email says;

"The lines from the **** to the ++++ are a function defintion and should be AFTER the end of the main program. You aonly need to call the mean function in the main program

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?