Write a program that reads students’ names followed by their test score. The pro
ID: 3625145 • Letter: W
Question
Write a program that reads students’ names followed by their test score. The program should output each student’s name followed by the test score and relevant grade. It should also find and print the highest test score and the name of the student having the highest test scoreStudent 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 ) and grade of type char. Suppose that the class has 20 students. Use an array of 20 components to type StudentType
Your program should contain the following function:
1. A function to read the student’s data into the array
2. A function to assign the relevant grade to each student
3. A function to find the highest score
4. A function to print the names of students having the highest test score
I know how to do it but i don't understand how to make a structure into an array
Explanation / Answer
Ok so when you make your structure in C++ it might look something like this
typedef struct StudentType
{
string studentFName;
string studentLName;
int testScore;
char grade;
} STUDENTTYPE;
So when you want to turn this into an array of studenttypes you would make a variable like so:
STUDENTTYPE students[20];
So now you have a variable, student, that uses the structure declared above, and is an array.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.