Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 18, Problem 3PP
Program Plan Intro

Students Records

Program Plan:

  • Include required header file.
  • Include required “std” namespace.
  • Define a structure for “StudentInfo”.
    • Declare variable for student name and grade.
  • Define the function for student records order.
  • Define main function
    • Declare variable “stud” in “vector” template class.
    • Create an object for student structure “StudentInfo”.
    • Declare and initializes the required variable.
    • Performs “do-while” loop. This loop executes until the option is not equal to “y” or “Y”.
      • Read the student name from user.
      • Read the student grade from user.
      • Then push the student name and their grade into vector using “push_back()” function.
      • Read the again option from user.
    • Then store the maximum size for student name.
    • Display the student records using “for” loop.
    • Then compute the maximum and minimum grade and after that compute the grade average.
    • Display the maximum, minimum and average grade.
    • Sort the names in student records using “sort” function.
    • Finally display the student names and their grades after sorting.

Blurred answer
Students have asked these similar questions
Integer numin is read from input. Given the integer vector yearlySalary with the size of numin, write a for loop to initialize the first half of yearlySalary with the remaining integers read from input. Ex: If the input is 6 116 132 134 then the output is: 116 132 134 0 0 0 Note: The vector size is always even. 5 int main() { 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21} vector yearlySalary; unsigned int i; int numIn; cin >> numIn; // Creates a vector of size numIn and initialize all values to 0 yearlySalary.resize(numIn); /* Your code goes here */ for (i = 0; i < yearlySalary.size(); ++i) { cout << yearlySalary.at (i) << " "; } return 0;
In C++,define a vector object and initialize it with 3 values and then define an iterator that points to elements of this object, then ask the user to enter 3 more values and then add them to the previous vector and then print all elements in the vector.
In C++   This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers in one int vector and the ratings in another int vector. Output these vectors (i.e., output the roster).  (2) Implement a menu of options for a user to modify the roster. Each option is represented by a single character. The program initially outputs the menu, and outputs the menu after a user chooses an option. The program ends when the user chooses the option to Quit. For this step, the other options do nothing. (3) Implement the "Output roster" menu option. Ex: ROSTER Player 1 -- Jersey number: 84, Rating: 7 Player 2 -- Jersey number: 23, Rating: 4 ... (4) Implement the "Add player" menu option. Prompt the user for a new player's jersey number and rating. Append the values to the two vectors. Ex:…
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning