QuestionQuestion

Read the file with grades and do the following:

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 PreviewSolution 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);...
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats