· There are 100 studentsin a school (IDs 0 to 99) · We need to store theirMath a
ID: 3614422 • Letter: #
Question
· There are 100 studentsin a school (IDs 0 to 99)
· We need to store theirMath and Science scores in an array
o Note: Use two-dimensional array with rows indexed bystudent IDs
o Column is indexed by type of subject (0 is Math, 1 isscience)
o Example: score[7][0] = 71 à Student 7’sMath score is 71
o Example: score[17][1] = 83 à Student17’s Science score is 83
· Fill all thestudents’ Math and Science scores with random numbers
o Generate random numbers between 60 and 100 à60 + rand()%41
o Store the number as the score in array
· Compute the average ofall 100 scores (math average and science average)
o Math_average is the Sum of all math scores divided by100.
Inside while(1) àinfinite while loop
· Ask the user “Enter student ID (0 to 99):”
· Print the student’s scores.
o Your Math score is:XX , The average Math score is: XX
o Your Science score is:XX , The average Science score is: XX
· After printing, the code should go back to “Enter student ID(0 to 99):”
o This loop should never end, always finding astudent’s score
· ***Important: If Ienter same student ID twice, the program should give me thesame scores, since they are safely stored in the array
Explanation / Answer
please rate - thanks #include #include using namespace std; int main() { int scores[100][2],i,j,math=0,science=0,id; double matha,sciencea; srand(time(0)); for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.