Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ // please solve Input/Text file: 0 3 2 4 1 2 4 3 5 1 2 0 3 2 6 4 2 1 0

C++ // please solve

image text in transcribed

Input/Text file:

0 3 2 4 1 2 4 3 5 1 2 0 3 2 6 4 2 1 0 4 1 3 0 2 4 3 6 1 3 0 2 4 1 0 5 2 1 2 0 2 3 5 6 2 0 5 4 2 3 0 4 3 2 5 1 0 5 3 2 3 2 5 3 1 4 2 0 3 2 1 4 3 1 5 3 2 3 0 5 2 4 3 5 2 1 5 4 2 0 3 0 2 1 3 4 2 1 4 2 0

Exercise 2: A text file represents soccer scores of 10 team league is provided. Create a matrix R with size 10*10. Rij is the number of goals scored by team against team j. For instance, R[1,2] = 5 means team 1 scored 5 goals against team 2. Read matrix R from the given file. Note, Rii =0 for all i. Write a function that calculates and returns total points gained by a given team. A team can be represented by its index. The winner is given 3 points and the loser gets 0 point. In case of a tie, each team gets 1 point. Test the function in the main by printing total points of all the teams. Sample o/p: Total points gained by individual Teams: Team1 = 18 Team2 = 10 Team3 = 11 Team4 = 7 Team5 = 13 Team6 = 15 Team7 = 7 Team8 = 17 Team9 = 18 Team 10 = 13 Hint: Use () operator for reading the matrix

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

Step: 3

blur-text-image

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions