Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ Consider we have our own Programming League of four teams, where each Team 3ompetes among each other. At the end of the league,

Using C++

Consider we have our own Programming League of four teams, where each Team 3ompetes among each other. At the end of the league, each team will have had a Programming Match with its opponent. In a match, each team is provided a score between 1 and 100. For example here are sample scores:

Team 1 100 - 96 Team 2

Team 3 94 - 92 Team 4

Team 1 94-98 Team 3

Team 2 99-97 Team 4

Team 1 89- 91Team 4

Team 2 99-98 Team 3

The difference of the scores in a match will be used to determine the champions. In the table below using the above sample scores, each element of the table shows how many points a Team 1cross the rows scored more than the Team 1cross the columns in their respective match. For example, since Team 1 scored 4 points more than Team 2 in their match, Row 1 Column 2 is 4. For the same reason, Row 2 Column 1 is -4. Since Team 3annot play with itself, that corresponding value is zero.

image text in transcribed

To find the winner, we will sum across the columns. In this example, since the Row 3 will have the highest sum across the columns, Team 3 are the champions. Write a program to implement this requirement. In your program, declare a two-dimensional array. You will need to read the scores of each match from the user, calculate the difference and store in your two dimensional array. Now, using the same logic as in the above example, your program needs to determine who won the championship. Display on the screen the elements of the two-dimensional array along with the team that won the championship.

HINT:Create a nested loop, assign inner loop to columns and outer loop to rows. Ask the user for the scores of the match between the two teams specified by the two loop control variables. After the user enters the scores, calculate the difference and store in appropriate location in the array. Remember the user will have to enter the score of the same match twicefor example to calculate Row 1 Column 2 and Row 2 Column 1 in the above table. Can you avoid this requirement? Think about it, but you dont have to implement this to get full grade for this problem. Remember a Team 3annot play against itself, so dont ask the user for the score in that case.

Team 1 Team 2 Team 3 Team 4 Team 1 Team 2 Team 3 -1 C Team 4 -2-2-2-0 Tu--4-1 0-2 T-4 O T40 Tu-0 |-4-4-2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

84 Job analysis and job description methods.

Answered: 1 week ago

Question

Convert to decimals 10110.01012 26.248

Answered: 1 week ago