This program is correct, it repeatedly asks the user to enter a score till you enter a negative or a number over 100. Than it adds all the scores and counts how many scores entered.

Now the problem is I have to write a function called "average" that will will return the average (total sum/count). I am not sure how to do that.
Can someone Halp me Please. Average must be a function.

usingnamespace std;
int main(){
int score, sum, count;
cout << "enter a score:" ;
cin >> score;
count = 1;
sum = score;
while(score >= 0 && score <= 100){
cout << "enter a score:" ;
cin >> score;
sum = sum + score;
cout << sum << endl;
cout << count << endl;
return 0;

You can write the function something along the lines of:

double average( int my_sum, int my_count )
   // write your code here

int main( void )
     // all other declarations
     double avg = 0.0 ;

     // write the code which accepts scores
    avg = average( sum, count ) ;

Fill in the spaces and you should get the program up and running...