Question: Write a C++ program to analyze league standings (data). Read in the standings from a file called OverwatchLeague.txt available on Canvas. You will need to
Write a C++ program to analyze league standings (data). Read in the standings from a file called OverwatchLeague.txt available on Canvas. You will need to use basic File I/O to do this. Display a menu of options to the user. Options will include the following:
- Allow the user to display all teams and their winning percentage.
- Allow the user to display individual division standings. This will display all teams in the division along with their number of wins, losses, and winning percentage. You will need to ask the user what conference and division.
- Allow the user to sort the teams by winning percentage.
- Allow the user to quit your program.
It is required that you store the standings in a dynamically allocated array or arrays. If the user wants to analyze a different league such as a basketball league or hockey league with different numbers of leagues and teams your program will still work. They would just need to provide a different input file such as NHLdata.txt for the National Hockey League. On Canvas is another standings files called LittleLeague.txt and "NFLdata.txt".
Note that the number of teams in the file to be analyzed varies and you need to dynamically allocate for that. Note that for each team the input file contains: team name, team mascot, conference/division, wins, losses, ties, and winning percentage. It is required that you group this team data as an individual collection called a struct. Give your struct a name like TeamInfo.
It is expected that you write your program with major chunks of the program being functions. For example, sorting is a natural function and displaying standings is a natural function. (Also swap is a natural function called by a sorting function, etc. In the main function include the logic for the user menu and call functions within that logic. The result will be a cleanly organized main function.
REQUIRED output is provided below (Output should look exactly like RequiredOutputHW1.txt. This is one example run of the program with LittleLeague.txt).

Overwatch.txt

League Standings Analysis Menu 1. Display the full standings 2. Display an individual division standings 3. Sort the standings by winning% 4. Exit the program Enter your choice: 1 Displaying the entire League: League standings BE Team Mystery Blue Flying Brutal Glorious Wild True Heavenly Angry Red Mysterious Purple Steel Rough Swift Brute Chief Magic Marvelous Blue Gruesome Incredible Major Gruesome Flying Red Flawless Young Blue Exalted Eager Glorious Brown Spotted Magic Stark Nine New Careless Fast Infamous Pure Grizzly Yellow Spectacular Flying Brute Fabulous Valiant Ancient Red White Road Purple Flying Major Epic Daring Blue Skeleton Mascot Koalas Boomers Boars Rovers Penguins Magicians Spartans Angels Goblins Riddles Capes Pumas Tornadoes Wasps Mallards Turtles Keefs Johnson Gorillas Peacocks Spartans Crusader Chiefs Gators Rockets Cubs Bulls Saints Orcas Cardinals Sparks Dogs Cougars Leopards Werewolves Crunchers Mambas Vipers Ravens Birds Storms Orcas Baboons Monsters Wolves Cubs Explorers Giraffes Ants Phantoms Rams Goats Runners Queens Asteroids Parrots Wolverines Dashers Trolls Orcs Conf/Div U1213_East U1415_South U1213_West U1213_North U1213_East U1213_South U1617_West U1617_North U1213_East U1213_South U1213_West U1213_North U1213_East U1213_South U1213_West U1213_North U1213_East U1213_South U1213_West U1213_North U1213_East U1213_South U1213_West U1213_North U1415_East U1213_South U1415_West U1415_North U1415_East U1415_South U1415_West U1415_North U1415_East U1415_South U1415_West U1415_North U1617_East U1415_South U1415_West U1415_North U1415_East U1415_South U1617_West U1617_North U1617_East U1617_South U1617_West U1617_North U1617_East U1617_South U1617_West U1617_North U1415_East U1617_South U1617_West U1213_North U1617_East U1617_South U1213_West U1617_North Wins 5 4 3 7 14 5 8 12 5 6 9 3 11 2 8 0 15 1 16 10 5 4 3 7 14 5 8 12 5 6 9 3 11 2 8 0 15 1 16 10 5 4 3 7 14 5 8 12 5 6 9 3 11 2 8 0 15 1 16 19 Losses Winning% 11 0.313 12 0.25 13 0.187 9 0.438 2 0.875 19 0.344 8 0.5 4 0.75 11 0.313 10 0.375 7 0.563 12 0.219 5 0.688 14 0.125 8 0.5 16 0 1 0.9375 15 0.0625 1 6 0.625 11 0.313 12 0.25 13 0.187 9 0.438 2 0.875 10 0.344 8 0.5 4 0.75 11 0.313 19 0.375 7 0.563 12 0.219 5 0.688 14 0.125 8 0.5 16 0 1 0.9375 15 0.0625 9 1 6 0.625 11 0.313 12 0.25 13 0.187 9 0.438 2 0.875 10 0.344 8 0.5 4 0.75 11 0.313 10 0.375 7 0.563 12 0.219 5 0.688 14 0.125 8 0.5 16 0 1 0.9375 15 0.0625 1 6 0.625 ******************************************************* 15 0.286 0.892 mem 0 0 0.75 0 0.708 0 0.72 0.923 0.545 0.931 Vancouver Titans PAC_West San_Francisco Shock PAC_East Paris Eternal ATL_North 18 Philadelphia Fusion ATL_South Florida Mayhem ATL_South 17 Los_Angeles Valiant PAC_West Guangzhou Charge PAC_West 18 Shanghai Dragons PAC_East Hangzhou Spark PAC_East 12 Toronto Defiant ATL_North 8 London Spitfire ATL_North 6 Boston Uprising ATL_North Chengdu Hunters PAC_East 8 Dallas Fuel PAC_West 9 Houston Outlaws ATL_South Seoul Dynasty PAC_East 12 Atlanta Reign ATL_South 10 Washington Justice ATL_South New_York Excelsior ATL_North Los_Angeles Gladiators PAC_West 25 6 24 7 12 7 27 11 14 15 19 14 11 15 12 11 4 16 11 3 10 0 2 0 0 0 19 4 11 0.522 0.364 0.286 0.095 0.364 0.45 0.286 0.5 0.476 0 18 0 17 0.19 0.666 0.524 10 0 League Standings Analysis Menu 1. Display the full standings 2. Display an individual division standings 3. Sort the standings by winning% 4. Exit the program Enter your choice: 1 Displaying the entire League: League standings BE Team Mystery Blue Flying Brutal Glorious Wild True Heavenly Angry Red Mysterious Purple Steel Rough Swift Brute Chief Magic Marvelous Blue Gruesome Incredible Major Gruesome Flying Red Flawless Young Blue Exalted Eager Glorious Brown Spotted Magic Stark Nine New Careless Fast Infamous Pure Grizzly Yellow Spectacular Flying Brute Fabulous Valiant Ancient Red White Road Purple Flying Major Epic Daring Blue Skeleton Mascot Koalas Boomers Boars Rovers Penguins Magicians Spartans Angels Goblins Riddles Capes Pumas Tornadoes Wasps Mallards Turtles Keefs Johnson Gorillas Peacocks Spartans Crusader Chiefs Gators Rockets Cubs Bulls Saints Orcas Cardinals Sparks Dogs Cougars Leopards Werewolves Crunchers Mambas Vipers Ravens Birds Storms Orcas Baboons Monsters Wolves Cubs Explorers Giraffes Ants Phantoms Rams Goats Runners Queens Asteroids Parrots Wolverines Dashers Trolls Orcs Conf/Div U1213_East U1415_South U1213_West U1213_North U1213_East U1213_South U1617_West U1617_North U1213_East U1213_South U1213_West U1213_North U1213_East U1213_South U1213_West U1213_North U1213_East U1213_South U1213_West U1213_North U1213_East U1213_South U1213_West U1213_North U1415_East U1213_South U1415_West U1415_North U1415_East U1415_South U1415_West U1415_North U1415_East U1415_South U1415_West U1415_North U1617_East U1415_South U1415_West U1415_North U1415_East U1415_South U1617_West U1617_North U1617_East U1617_South U1617_West U1617_North U1617_East U1617_South U1617_West U1617_North U1415_East U1617_South U1617_West U1213_North U1617_East U1617_South U1213_West U1617_North Wins 5 4 3 7 14 5 8 12 5 6 9 3 11 2 8 0 15 1 16 10 5 4 3 7 14 5 8 12 5 6 9 3 11 2 8 0 15 1 16 10 5 4 3 7 14 5 8 12 5 6 9 3 11 2 8 0 15 1 16 19 Losses Winning% 11 0.313 12 0.25 13 0.187 9 0.438 2 0.875 19 0.344 8 0.5 4 0.75 11 0.313 10 0.375 7 0.563 12 0.219 5 0.688 14 0.125 8 0.5 16 0 1 0.9375 15 0.0625 1 6 0.625 11 0.313 12 0.25 13 0.187 9 0.438 2 0.875 10 0.344 8 0.5 4 0.75 11 0.313 19 0.375 7 0.563 12 0.219 5 0.688 14 0.125 8 0.5 16 0 1 0.9375 15 0.0625 9 1 6 0.625 11 0.313 12 0.25 13 0.187 9 0.438 2 0.875 10 0.344 8 0.5 4 0.75 11 0.313 10 0.375 7 0.563 12 0.219 5 0.688 14 0.125 8 0.5 16 0 1 0.9375 15 0.0625 1 6 0.625 ******************************************************* 15 0.286 0.892 mem 0 0 0.75 0 0.708 0 0.72 0.923 0.545 0.931 Vancouver Titans PAC_West San_Francisco Shock PAC_East Paris Eternal ATL_North 18 Philadelphia Fusion ATL_South Florida Mayhem ATL_South 17 Los_Angeles Valiant PAC_West Guangzhou Charge PAC_West 18 Shanghai Dragons PAC_East Hangzhou Spark PAC_East 12 Toronto Defiant ATL_North 8 London Spitfire ATL_North 6 Boston Uprising ATL_North Chengdu Hunters PAC_East 8 Dallas Fuel PAC_West 9 Houston Outlaws ATL_South Seoul Dynasty PAC_East 12 Atlanta Reign ATL_South 10 Washington Justice ATL_South New_York Excelsior ATL_North Los_Angeles Gladiators PAC_West 25 6 24 7 12 7 27 11 14 15 19 14 11 15 12 11 4 16 11 3 10 0 2 0 0 0 19 4 11 0.522 0.364 0.286 0.095 0.364 0.45 0.286 0.5 0.476 0 18 0 17 0.19 0.666 0.524 10 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
