Answer:
See explaination
Explanation:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
void readStudentsData();
void levels(int&,int&,int&);
int main()
{
string studentsName[50];
int grade[50];
int highestScore = 0;
int belowAverage = 50;
int countStudents = 0;
int sum = 0;
int score[5]=
double average = 0;
ifstream infile;
ofstream outfile;
void readStudentsData();
infile.open("c:\\Data.txt");
int numOfStudents = 0;
infile >> studentsName[numOfStudents] >> grade[numOfStudents];
While (infile && numOfstudents < 50)
{
numOfStudents++;
infile >> studentsName[numOfStudents] >> grade[numOfStudents};
}
if (!infile)
{
cout << "File does not open." << endl;
return 1;
}
outfile.open("c:\\average.out");
outfile << fixed << showpoint;
outfile << setprecision(2);
infile >> studentsName;
infile >> score1 >> score2 >> score3 >> score4 >> score5 >>;
outfile << left << setw(20) << "Students Name"
<< setw(5) << "Score 1" << setw(5) << "Score 2"
<< setw(5) << "Score 3" << setw(5) << "Score 4"
<< setw(5) << "Score 5" << setw(5) << "Grade"
<< setw(5) << "Average" << setw(5) << "Below average"
<< setw(5) << "Highest" << endl;
if (average >= 90)
cout << "A" << endl;
else if (average >= 80)
cout << "B" << endl;
else if (average >= 70)
cout << "C" << endl;
else if (average >= 60)
cout << "D" << endl;
else
cout << "F" << endl;
}
average = static_cast<double>(score1+score2+score3+score4+score5) /5;
void level(int &highestScore,int &belowAverage,int &sum);
{
int level,high = 0,low = 17;
infile >> level;
while(level!=-1)
{
sum = sum + level;
if (level > high)
{
high = level;
infile >> level;
}
else
if (level < low)
{
low = level;
infile >> level;
}
else
if infile >> level;
}
outfile << ' ' << high;
else
if (high > highestScore)
highestScore=high;
else
if (low < belowAverage)
belowAverage=low;
}
do
{
cout << "Students Name: ";
cin >> name
cout << "Input score: " << endl;
cin >> score1>> score2>> score3>> score4>> score5;
cout << Students Name << Highest score);
}
While (highest score !=0);
infile.close();
outfile.close();
return 0;
}