Create a C++ app that reads data from a text file into a vector of structs and sorts the vector elements.
Use this data file: mlb_pitchers.csv.
Each line of data contains a pitcher’s name and the number of games he won during his career in the big leagues.
Create a struct data type named Pitcher that stores these two data items in member variables of the appropriate type.
Declare a variable of type Pitcher that is local to the main() function.
Test point: test your code by manually setting your Pitcher variable’s member data and displaying the values.
Use a loop to read each line of data from the data file into a vector that has elements of type Pitcher.Use std::string::substr() to separate the pitcher’s name from his number of wins, and store the name in your Pitcher variable.
Use std::stoi() to convert the number of wins represented as text in the file to a number, and store the number in your Pitcher variable.
Use std::vector::push_back() to add the prepared Pitcher to your vector.
Test point: test your code by displaying the name and number of wins in each vector element.
Write function bool compare_pitchers() that compares the ERA of two Pitcher instances. You will use this function as an argument to std::sort().Function compare_pitchers() should take two reference parameters of type Pitcher.
compare_pitchers() should return true if the first Pitcher has a lower number of wins, false otherwise.
Call std::sort() to sort the Pitchers in your vector by ERA, lowest to highest.
Display all elements of your sorted vector. Include all data fields and format your output nicely . Sample output
What to submitSubmit your completed .cpp file. Double-check the rubric to avoid losing points.
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount