Question
In C++ Write a program that reads a file called QBInfo.txt of game records for NFL Quarterbacks and allows the user to print out selected
In C++
Write a program that reads a file called QBInfo.txt of game records for NFL Quarterbacks and allows the user to print out selected information about the players.
A sample file is available below the lab assignment pdf.
The file will consist of a number followed by a series of records. The number represents how many records are in the file. If you are not doing the challenge, you can read in the number and ignore it and assume there are 3 records. Each record has a QB's name on the first line, followed by the stats from 10 games.
Each game log has the following 5 stats in order:
Completions Attempts Yards TouchDowns Interceptions.
Write a program to read in the data and store it in a structured format. You can pick your representation, but it must make use of structs and arrays.
Then present the following options to the user: 1: Print Player 2: Print Player Stats 3: Print Passer Ratings 4: Exit If the user choses 1, read in a number representing which player number (assume first player from file is #1, second is #2, etc). Print that player's name and the stats from each of the 10 games the player played. If the user choses 2, again read in a number representing which player number. Only this time print their print their total Attempts, Completions, Yards, TouchDowns and Interceptions over the 10 games. If they chose 3, print the name and total Passer Rating over all 10 games (see background section at end of document) for each player. If they hit 4 the program should end.
// for passer rating formula:
http://en.wikipedia.org/wiki/Passer_rating
//The file "QBInfo.txt" contains:
3
Payton Manning
27 42 462 7 0
30 43 307 2 0
32 37 374 3 0
28 34 327 4 0
33 42 414 4 1
28 42 295 2 1
29 49 386 3 1
30 44 354 4 3
25 36 330 4 0
24 40 323 1 0
Tom Brady
29 52 288 2 1
19 39 185 1 0
25 36 225 2 1
20 31 316 2 0
18 38 197 0 1
25 43 269 1 1
22 46 228 0 1
13 22 116 1 1
23 33 432 4 0
29 40 296 1 1
Drew Brees
26 35 357 2 1
26 46 322 1 2
29 46 342 3 1
30 39 413 4 0
29 35 288 2 0
17 36 236 2 1
26 34 332 5 0
30 51 382 2 2
34 41 392 4 0
30 43 305 1 1
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