This program is receive upto 25 grades and average them and display the results. It is in the required format, but there is atl least one logic error that I am not seeing. any help would be greatly appreciated.

Thanks Steve



#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>

int getinput(float array[]);
void mainmenu();
float Calculateaverage ( float array[], int count);
void Displayarray( float array [], float avg, int count);


main()
{

int choice, count;
float avg;
float array[25] = {0};

do
{
mainmenu();
cin >> choice;
if ( choice == 1 )
{
count = getinput ( array );
avg= Calculateaverage( array, count);
Displayarray( array, avg, count);
}
else
break;


}while ( choice !=2 );

}

/************************************************** **********************
thepurpose of this function is to format the screen and present the user
with options.
************************************************** **********************/
void mainmenu()
{
// system ("cls");
cout<<"1-Enter Numbers"<<endl;
cout<<"2-Exit "<<endl;

}


/************************************************** ********************
The pupose of this function is to receive input from the user and pass
back the necessassary information.
************************************************** ********************/
int getinput(float array[])
{

float num;
int s;

cout<<"if you wish to exit before entering all 25 numbers enter 999"<<endl;

for (s=0;s<25;s++)
{
cin>> num;
if (num == 999)
break;
else
array[s] = num;

}

return s;
}

/************************************************** ********************
the purpose of this function is to receive pertnet information and
generate and average, and pass it back to main;
************************************************** *******************/

float Calculateaverage( float array[], int count)
{
int s;
float sum, avg;



for (s=0;s<count;s++)
{
sum += array[s];


}
cout<<"we are in calcavg"<<endl;
avg= (sum / count);
return avg;
cout<<avg<<endl;

}
/************************************************** ******************
The pupose of this function is to display the results to the screen.
************************************************** *******************/
void Displayarray( float array[], float avg, int count)
{
int s;
for (s=0;s<count;s++)
{
cout<<array[s]<<endl;
cout<<avg<<endl;


}


}