In c++
On December 15, 2022 there were five Football matches in the US.
You are given a text file called Games-input.txt. This file
has the names of the ten teams that played on that day along with
the points they scored at the end of each quarter.
For example: The following means that the match was between
Las_Vegas_Raiders and Los_Angeles_Chargers
Las_Vegas_Raiders
2
4
3
2
Los_Angeles_Chargers
1
5
7
2
Where 2 4 3 2 means the points scored by Las_Vegas_Raiders
on Quarter 1, Quarter 2, Quarter 3 and Quarter 4 respectively. The
same applies to all other teams in the input
file.
Your program must contain a functions to initialize two array
structures, a 1-D array that contains the names of the teams
playing, and a 2-D array (with dimensions 10x4) that contains the
scores earned by each team during these games; a function that
displays information what teams played and their points for each
quarter; a function to calculate the total score of each team; and
a function to print the five highest total scores and their
respective teams.
(The only global variable that is allowed in the number of
columns)
Below are the specifications for each required
function:
teamStatsDisplay: This function takes an output file reference,
a 1-D string array, a 2-D integer array, and the integer for the
number of rows. The function should display the contents of both
array structures as shown below:
======= Team game statistics
Las_Vegas_Raiders
2 4 3 2
Los_Angeles_Chargers
1 5 7 2
-------------------
Los_Angeles_Rams
0 5 2 0
Miami_Dolphins
3 1 0 2
-------------------
Minnesota_Vikings
1 1 2 1
New_England_Patriots
2 4 4 1
-------------------
New_Orleans_Saints
1 1 2 2
New_York_Giants
3 5 6 2
-------------------
New_York_Jets
0 0 2 0
Philadelphia_Eagles
3 2 3 4
-------------------
searchTeamStats: This function takes as its parameter the string
array, the 2-D integer array, and the integer corresponding to the
number of rows. The function should prompt the user for the name of
a team and display to the console, the name of the team, their
corresponding scores, their opponent and their corresponding
scores. This function should not return any value but display the
results of the search. If the team is not found, display the
appropriate message.
Tip: Keep in mind that if the given team is in an even index
number, its opponent is in in the next index number; otherwise, its
opponent is in its previous index.
Output:
Writing all football matches to games_out.txt ...
Enter team name to see their final score >>
New_England_Patriots
Team found
Display game statistics
New_England_Patriots vs. Minnesota_Vikings
=====================
Q1
Q2
Q3
Q4
New_England_Patriots
2
4
4
1
Minnesota_Vikings
1
1
2
1
Printing top five teams and total scores ...
initTeamsList: The function takes as an input file reference, a
1-D string array, a 2-D integer array, and the integer for the
number of rows. The function should initialize the contents
of each array structure accordingly. Each line of input is laid out
as follows: the team name, score for the first quarter, score for
the second quarter, score for the third quarter, score for the
fourth quarter.
printWinningTeam: The function takes as an output file
reference, a 1-D string array, a 2-D integer array, and the integer
for the number of rows. The function should calculate the
total score of each team and display the highest scores.
Complete the questions below.
Write C++ code to declare a 1-D array and a 2-D array. These
structures will store the information contained in the file
Games-input.txt. These arrays must be:
a. A string array called usaTeams to store the name of
each team of size 10.
b. A 10x4 integer array called teamScores where each
column corresponds to the points earned by each team during the
four quarters.
Write the function prototypes and calls for each listed function
description above.
Write the function definition
for searchTeamStats function specifications
above.
Attach the screenshot of a successful and complete execution of
your program below (Hint: Use the snipping tool to take
screenshots):
In c++ On December 15, 2022 there were five Football matches in the US. You are given a text file called Games-input.txt
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
In c++ On December 15, 2022 there were five Football matches in the US. You are given a text file called Games-input.txt
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!