Write a program that records and displays league standings for a baseball league. The program will ask the user to enter five team names, and five win amounts. It will store the data in memory, and print it back out sorted by wins from highest to lowest. The sample output from your program should look something like this (user input in bold orange): Enter team #1: Padres Enter the wins for team #1: 75 Enter team #2: Dodgers Enter the wins for team #2: 91 Enter team #3: Giants Enter the wins for team #3: 92 Enter team #4: Rockies Enter the wins for team #4: 65 Enter team #5: Diamondbacks Enter the wins for team #5: 70 League Standings: Giants: 92 Dodgers: 91 Padres: 75 Diamondbacks: 70 Rockies: 65 Requirements The data must be stored in two parallel arrays: an array of strings named teams, and an array of ints named wins.  These arrays must be declared in the main() function.  You can assume that the league has five teams, so each of the arrays should have five elements. As usual, you may not use any global arrays or global variables.   All of the user input must be done in a function named initializeArrays.  It must have the following signature: void initializeArrays(string names[], int wins[], int size) You must also write two more functions: one to sort both arrays, and one to display the final (sorted) list of team names and scores. They must have the following signatures: void sortData(string names[], int wins[], int size) void displayData(string names[], int wins[], int size) The main function should be very short. It should just declare the arrays and then call these three functions

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program that records and displays league standings for a baseball league. The program will ask the user to enter five team names, and five win amounts. It will store the data in memory, and print it back out sorted by wins from highest to lowest.

The sample output from your program should look something like this (user input in bold orange):

Enter team #1: Padres
Enter the wins for team #1: 75
Enter team #2: Dodgers
Enter the wins for team #2: 91
Enter team #3: Giants
Enter the wins for team #3: 92
Enter team #4: Rockies
Enter the wins for team #4: 65
Enter team #5: Diamondbacks
Enter the wins for team #5: 70

League Standings:
Giants: 92
Dodgers: 91
Padres: 75
Diamondbacks: 70
Rockies: 65

Requirements

The data must be stored in two parallel arrays: an array of strings named teams, and an array of ints named wins.  These arrays must be declared in the main() function.  You can assume that the league has five teams, so each of the arrays should have five elements.

As usual, you may not use any global arrays or global variables.  

All of the user input must be done in a function named initializeArrays.  It must have the following signature:

void initializeArrays(string names[], int wins[], int size)

You must also write two more functions: one to sort both arrays, and one to display the final (sorted) list of team names and scores. They must have the following signatures:

void sortData(string names[], int wins[], int size)
void displayData(string names[], int wins[], int size)

The main function should be very short. It should just declare the arrays and then call these three functions.

Write a program that records and displays league standings for a baseball league. The program will ask the user to enter
five team names, and five win amounts. It will store the data in memory, and print it back out sorted by wins from
highest to lowest.
The sample output from your program should look something like this (user input in bold orange):
Enter team #1: Padres
Enter the wins for team #1: 75
Enter team #2: Dodgers
Enter the wins for team #2: 91
Enter team #3: Giants
Enter the wins for team #3: 92
Enter team #4: Rockies
Enter the wins for team #4: 65
Enter team #5: Diamondbacks
Enter the wins for team #5: 70
League Standings:
Giants: 92
Dodgers: 91
Padres: 75
Diamondbacks: 70
Rockies: 65
Requirements
The data must be stored in two parallel arrays: an array of strings named teams, and an array of ints named wins. These
arrays must be declared in the main() function. You can assume that the league has five teams, so each of the arrays
should have five elements.
As usual, you may not use any global arrays or global variables.
All of the user input must be done in a function named initializeArrays. It must have the following signature:
void initializeArrays(string names [], int wins[], int size)
You must also write two more functions: one to sort both arrays, and one to display the final (sorted) list of team names
and scores. They must have the following signatures:
void sortData(string names[], int wins[], int size)
void displayData(string names[], int wins[], int size)
The main function should be very short. It should just declare the arrays and then call these three functions.
Transcribed Image Text:Write a program that records and displays league standings for a baseball league. The program will ask the user to enter five team names, and five win amounts. It will store the data in memory, and print it back out sorted by wins from highest to lowest. The sample output from your program should look something like this (user input in bold orange): Enter team #1: Padres Enter the wins for team #1: 75 Enter team #2: Dodgers Enter the wins for team #2: 91 Enter team #3: Giants Enter the wins for team #3: 92 Enter team #4: Rockies Enter the wins for team #4: 65 Enter team #5: Diamondbacks Enter the wins for team #5: 70 League Standings: Giants: 92 Dodgers: 91 Padres: 75 Diamondbacks: 70 Rockies: 65 Requirements The data must be stored in two parallel arrays: an array of strings named teams, and an array of ints named wins. These arrays must be declared in the main() function. You can assume that the league has five teams, so each of the arrays should have five elements. As usual, you may not use any global arrays or global variables. All of the user input must be done in a function named initializeArrays. It must have the following signature: void initializeArrays(string names [], int wins[], int size) You must also write two more functions: one to sort both arrays, and one to display the final (sorted) list of team names and scores. They must have the following signatures: void sortData(string names[], int wins[], int size) void displayData(string names[], int wins[], int size) The main function should be very short. It should just declare the arrays and then call these three functions.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education