Question
Write a loop to:
◦Read each record
◦Calculate the letter grade
◦Determine who has and what is the highest score.
◦Write to out.txt as shown below, formatting output so columns line up.
After the loop, output what is and who has the highest score.
Highest Score: 100 Mary Marvelous
Mark Simpsonite 95
Mary Marvelous 100
Milton Hamilton 82
Marvin Wilshire 76
Myrtle Millford 92
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
struct record{string first_name;
string last_name;
int score;
};
bool readfile(string filename, record r [], int & size);
bool HighestScore(record r [], int size, record & hs);
char grade(int score);
bool writefile(string filename, record r [], int size, record hs);
int main(int argc, char** argv) {
record r [100];
int size;
string in_file = "lab5inFile";
// read file
if (!readfile(in_file,r,size)) {
cout<<"Cannot open file "<<in_file<<" \n";
return 1;
}
record hs;// student who has highest score
HighestScore(r,size,hs);...