Question: Write a C++ program with comments, that reads students names followed by their test scores from the given input file. The program should output to
Write a C++ program with comments, that reads students names followed by their test scores from the given input file. The program should output to a file, output.txt, each students name followed by the test scores and the relevant grade.
Student data should be stored in a struct variable of type StudentType, which has four components: studentFName and studentLName of type string, testScore of type int and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type StudentType. Your program must contain at least the following functions:
A function to read the students data into an array.
A function to assign the relevant grade to each student.
Your program should output each students name in this form: last name followed by a comma, followed by a space, followed by the first name; the name must be left justified. Moreover, other than declaring the variables and opening the input and output files, the function main should only be a collection of function calls.
Your program should work on any test file used, that may be of a different size, although it's limiting it to 20 max. Make sure your program handles the last line of the file properly, because some of the test files will have a blank line at the end, some will not.
Sampleinput.txt
Bob Clanger 85 Laura Whitefoot 65 Tanta Gobold 90 Tolman Noaken 76 Hiligrim Fairbairn 91 Dorian Hoonbower 82
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
