Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions