Write a program that prompts the user to enter the number of students and each student’s name and score, and displays the name and score of the student with the highest score and the student with the second-highest score.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter9: Completing The Basics
Section: Chapter Questions
Problem 7PP
icon
Related questions
Question

The problem is from Introduction to Programming and Data Structures with C++, 4th edition

Write a program that prompts the user to enter the number of students and each student’s name and score, and displays the name and score of the student with the highest score and the student with the second-highest score.

Sample Run
Enter the number of students: 5
Enter a student name: Smith
Enter a student score: 60
Enter a student name: Jones
Enter a student score: 96
Enter a student name: Peterson
Enter a student score: 85
Enter a student name: Greenlaw
Enter a student score: 98
Enter a student name: Zhang
Enter a student score: 95
Top two students:
Greenlaw's score is 98.0
Jones's score is 96.0

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr