123k views
0 votes
Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays the student with the highest score and the student with the second highest score.

1 Answer

3 votes

Answer:

see attachment

Step-by-step explanation:

You have not specified the language, or the details of the I/O form or prompts. Here is a program that does that, written in Wolfram language (the language of Mathematica).

It prompts separately for student name and student score. The minimum score is presumed to be higher than -99999. If only one student name is entered, the second output is that score with no name listed. There is no error checking.

We have elected to keep a list only of the two two scores, and to sort that list again each time a new entry is made.

__

The attachment shows the output of the program below the program listing.

Write a program that prompts the user to enter the number of students and each student-example-1
User Fas
by
8.4k points