Question
write a C++ program that teams.txtcontains a list of Major League baseball teams in alphabetical order. winners.txtcontains a list of the World Series winning teams
write a C++ program that
teams.txtcontains a list of Major League baseball teams in alphabetical order.
winners.txtcontains a list of the World Series winning teams from 1903 to 2019. (The first line in the file is the name of the team that won in 1903, and the last line is the name of the team that won in 2019).
losers.txtcontains a list of the World Series losing teams from 1903 to 2019.
years.txtcontains a list of the years where the World Series was played. Note that the World Series was not played in 1904 or 1994.
Write a program that does the following: - displays the contents of teams.txt - prompts the user to enter the name of one of the teams. The program should then display
o the number of times that team has won the World Series in the time period from 1903 to 2019
o the year(s) when the team won
o the name(s) of the teams they defeated. - prompts the user to enter a year and display the name of the team who won the World Series on that year. Validate the input is between 1903 2019 inclusive. Display a proper message if the user enters 1904 or 1994, indicating that the World Series was not played that year. Hint: use the binary search algorithm.
Coding Requirements: - Use only vectors for loading data from files.
- You need to use getline when reading from files into vectors of strings. The loop condition may look like this: while(getline(inFile, temp)). Where temp is a string variable that will be pushed into a vector.
- Properly format your output
. - Design a good user interface and display the prompts in any way you want.
- Make sure that you use more than one function in your code.
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