I'm writing a code for the problem below and I have two issues
a- function header, prototypes, and call
b- I'm getting this message: There is not enough space on the disk
The problem is :
Write a program that dynamically allocates an array large enough to hold a number of test score. The size of the array should be input by the user. Once all the scores are entered, the array should be passed to a function that calculates the average score and returns the average. The main function should display the average. Do not accept negative numbers for test scores
//
# include <iostream>
# include <iomanip>
usingnamespace std ;
void average (double [], int); //<<===============================================================
int main ()
{
double *scores;
int numScores, count;
cout << " Please enter the number of test score"<< endl;
cin >> numScores;
if (numScores<=0)
{
return NULL;
}
scores= newdouble [numScores];
cout << " Enter the score for each test " << endl;
for (count =0; count < numScores,; count ++)
{
cout<< " Score " << (count+1) << " :" ;
cin >> scores[count];
}
average(scores,numScores ); //<<===============================================================
delete [] scores ;
scores = 0;
return 0;
}
void average (double scores, int numScores) //<<===============================================================
{
int total =0;
for (int count =0 ; count< numScores; count ++)
{
total += scores [numScores];
}
int avg = total/ numScores;
cout << " The average of the scores is : " << avg << endl;
}