Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ How to do this? Please help thanks... //Array, Functions 3. You are required to maintain several parallel one-dimensional arrays to keep some data about
C++ How to do this? Please help thanks...
//Array, Functions
3. You are required to maintain several parallel one-dimensional arrays to keep some data about the games belonging to a particular pool (i.e. group) during the rugby world that was held recently. The arrays are declared in the main program as follows: string team[5]; int play [5]; int win [5]; int draw [5]; int lose [5]; int points [5]; // team names // number of games played // number of games won // number of games drawn Il number of games lost // points awarded (c) Write a function that will read in the team name from a file to an array named team. The file must be declared, opened and closed within this function. The team names are stored in a file named teamNames.txt. teamNames.txt contains: ARG ENG NZL RSA WAL (d) Write a function that will initialize all the relevant arrays. (20/100) (e) Write a function that will update the relevant arrays after a game is played. After a game is played, both teams' number of games played will be incremented by one. The winning team's number of games won will be incremented by one and the losing team's number of games lost will be incremented by one. The winning team's point will be incremented by four. In case of a draw, both teams' number of games drawn will be incremented by one and their points will be incremented by two. A function call to update the result after Wales beat England by a score of 44 20 will look as follows: UpdateTable ("WAL", "ENG", 44, 20, ...); Where UpdateTable is the name of the function, while ... are the other actual parameters. Following are sample tables for one pool in the rugby world cup. The initial table: AUS ENG NZL RSA WAL OOOOO 3 OOOOOO Ooooor. Pts 0 0 0 0 0 0 The table after Wales beat England: Pts P AUS 0 ENG 1 NZL RSA WAL 1 30ooo- Oooooo OOOOR 0 0 0 0 4 1 (Note: P - Play, W-Win, D - Draw, L- Lose and Pts Points)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started