so, I am trying to write a program that it reads a list of numbers from a file output the numbers and get average, max, min and scores higher than average I have not idea what to do or how to approach I need to use all the prototypes that I already have in my program
int numberOfScores(string f); //count the number of scores in the input file
void inputScores(int* a, int n, string f); //input scores from a user selected input file
double avgScore(int* a, int n); //calculate the average score
int scoresGreaterAverage(int* a, int n, double avg); //calculate number of scores greater than average score
int highScore(int* a, int n); //find highest score
int lowScore(int* a, int n); //find lowest score
//main program
int main()
{
//variables/data
string fileName; //name of input file from the user
int count=0; //number of scores in the input file
int *scores;//scores (array) = store scores read from input file
int maxScore=0; //highest score of all the scores from the input file
int minScore=0; //lowest score of all the scores from the input file
int totalScores=0; //sum of all the scores from the input file
double averageScore; //average score of all the scores from the input file (formatted to 1 digit past decimal point)
int nGreater; //number of scores greater than the average score from all the scores in the input file
string line; //whatever is on each line of the input file
int i=0; // loop index
ifstream file; //file stream object
//get the file name
cout <<"What is the input file name? [filename.txt]: ";
cin >> fileName;
inputScores(scores, i, fileName);
file.open(fileName.c_str(), ios::in);
if (file)
{
getline(file, line);
//read an item from file
while(file)
{
//read the next item.
getline(file, line);
count++;
}
//close the file.
file.close();
cout << "The number of scores from file " << fileName<< " are: " << count<<endl;
}
else
{
cout << "Error: cannot open file.\n";
}
inputScores(scores, i, fileName);
for (i=0; i<count; i++)
return 0;
}//main
//count the number of scores in the input file
int numberOfScores(string f)
{
//variables
int x; //number of scores in the input file
return x;
}//numberOfScores
//input scores from a user selected input file
void inputScores(int* a, int n, string f)
{
ifstream file;
file.open(f.c_str());
{
if(file)
{
getline(file, line);
//read an item from file
while(file)
{
//read the next item.
getline(file, line);
}
cout<< "the scores are " << a[n] <<endl;
}
}
}//inputScores
//calculate the average score
double avgScore(int* a, int n)
{
//variable
double avg; //average score
return avg;
}//avgScore
//calculate number of scores greater than average score
int scoresGreaterAverage(int* a, int n, double avg)
{
//variable
int nGA; //number of scores greater than average
return nGA;
}//scoresGreaterAverage
int highScore(int* a, int n); //find highest score