Question
Write a C++ program that reads students names followed by their test scores from the text file. The program should output each students name followed
Write a C++ program that reads students names followed by their test scores from the text file. The program should output each students name followed by the test scores and the relevant letter grade. It should also find and print the highest test score and the names of the students having the highest test score.
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 (testScore is between 0 and 100)
grade of type char. Suppose that the class has 20 students.
Use an array of 10 components of type studentType.
Your program must contain at least the following functions:
a. A function to read the students data into the array.
b. A function to assign the relevant grade to each student.
c. A function to find the highest test score.
d. A function to print the names of the students having the highest test score.
Your program must 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.
students.txt
Johnson, Frederick, 96
Smith, John, 68
Goldberg, Mary, 88
Rogers, William, 98
Telta, Fina, 98
Fann, Corinna, 84
Zarwini, Yasir, 57
Pachos, Christine, 92
D'Aubigne, Valerie, 86
Baker, Dennis, 95
Nick, Richards, 67
Mike, Jordan,90
Johnson, Frederick, 96
Smith, John, 68
Goldberg, Mary, 88
Rogers, William, 98
Telta, Fina, 98
Fann, Corinna, 84
Zarwini, Yasir, 57
Pachos, Christine, 92
D'Aubigne, Valerie, 86
Baker, Dennis, 95
G "C: nts and Setti ministrata Test Score Grade tudent Nane Donald. Duckey Goofy. Goof Balto. Brave Snitn. Snow londerful, Alice Akthar. Sanina Green, Sinba Egger, Donald Deer, Brown Jackson. Johny Gupta. Greg lappy, Sanuel Arora.Danny June, Sleepy 85 89 93 93 89 85 95 90 86 95 nresel heng, Any aiik. She11y onek, Che1sea Clodfelter. Angela Nields Allison Nornan. Lance 80 80 78 83 95 95 95 95 Highest Test Score: 95 Students having the highest test score: Green. Sinba ackson Johny Malik, Shelly onk Chelsea Clodfelter. Angela Nields A1lison Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started