Try the fastest way to create flashcards
Question

# Recall the program that dynamically allocates an array large enough to hold a user-defined number of test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function was called that calculates the average score. The program displayed the sorted list of scores and averages with appropriate headings. It user pointer notation rather than array notation whenever possible.Modify that program to allow the user to enter name-score pairs. For each student taking a test, the user types a string representing the name of the student, followed by an integer representing the student’s score. Modify both the sorting and average-calculating functions so they take arrays of structures, with each structure containing the name and score of a single student. In traversing the arrays, use pointers rather than array indices.

Solutions

Verified
Step 1
1 of 6

In this exercise we are going to write program that asks user to input size of the array, and then makes array of structures student. Structure student is structure defined with two properties - name (string) and score (double). Program asks user for input for each student (element of the array). Then, program prints out array of structures student sorted in ascending order with average score. Let’s start by importing libraries and defining namespace.

#include <iostream>

using namespace std;


## Recommended textbook solutions

#### Starting Out with C++: Early Objects

8th EditionISBN: 9780133360929Godfrey Muganda, Judy Walters, Tony Gaddis
844 solutions

#### Fundamentals of Database Systems

7th EditionISBN: 9780133970777Ramez Elmasri, Shamkant B. Navathe
948 solutions

#### Introduction to Algorithms

3rd EditionISBN: 9780262033848Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
872 solutions

#### Introduction to Algorithms

4th EditionISBN: 9780262046305Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
945 solutions