Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
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
What is the difference between the size and capacity of a vector?
You are working for a university to maintain a list of grades and some related statistics for a student. Class and Data members: Create a class called Student that stores a student’s grades (integers) in a vector (do not use an array).  The class should have data members that store a student’s name and course for which the grades are earned. Constructor(s): The class should have a 2-argument constructor that receives the student’s name and course as parameters and sets the appropriate data members to these values. Member Functions: The class should have functions as follows: Member functions to set and get the student’s name and course variables. A member function that adds a single grade to the vector. Only positive grades are allowed.  Call this function AddGrade A member function to sort the vector in ascending order. A member function to compute the average (x̄) of the grades in the vector. The formula for calculating an average is x̄ = ∑xi / n  where xi is the value of each…
In C++ Create a function that takes in a vector, triples the size of the vector, sets all the values to random numbers, and returns the vector.
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