Question: Using c/c++, define a struct Student which has three properties: id, score, and grade. id is in integer type, score is in double type, and
Using c/c++, define a struct Student which has three properties: id, score, and grade. id is in integer type, score is in double type, and grade in char type. Using Student to declare an array with 20 elements in main() assign the ids of the students from 1 to 20; assign the scores of each student with random within [10, 99] then define a function and pass the student array as parameter(s). In the function, assign the grade of each student according to his score (e.g. if score is > = 90, assign 'A' grade; else if score is > = 80, 80, assign 'B' grade; else if score is > = 70, assign 'C'; else if score is > = 60, assign 'D'; otherwise, assign 'F'); Meanwhile, count the numbers of students receiving 'A', 'B', 'C', 'D', and 'E' accordingly; after the function returns, print all students' ids, scores, grades, and print the counting results. b. redefine the function to assign grades, but change it to a recursive one
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
