, , and have been included and main() looks like this: *attached image 1* The penalty.txt file contains the following data for 10 hockey players: The number of penalty minutes the player had in his career (integer) The number of seasons the player played (integer) The name of the player (string, more than one word) NOTE: There are 10 lines of data in the file, so all three data items for each player are on the same line. I wish I could attach the penalty.txt file, but it looks exactly like this: 3971 14 Tiger Williams 3565 19 Dale Hunter 3515 17 Tie Domi 3381 17 Marty McSorley 3300 17 Bob Probert 3207 15 Rob Ray
Assume <iostream>, <fstream>, and <string> have been included and main() looks like this:
*attached image 1*
The penalty.txt file contains the following data for 10 hockey players:
The number of penalty minutes the player had in his career (integer)
The number of seasons the player played (integer)
The name of the player (string, more than one word)
NOTE: There are 10 lines of data in the file, so all three data items for each player are on the same line.
I wish I could attach the penalty.txt file, but it looks exactly like this:
3971 14 Tiger Williams
3565 19 Dale Hunter
3515 17 Tie Domi
3381 17 Marty McSorley
3300 17 Bob Probert
3207 15 Rob Ray
3149 17 Craig Berube
3146 16 Tim Hunter
3043 13 Chris Nilan
2970 18 Rick Tocchet
Create code that would be a part of main() that does the following:
If the penalty.txt file fails to open, display a message saying the file could not be opened.
Otherwise, use a while loop to store each number of penalty minutes, years played, and name in their respective variables, use the data in a sentence, and store that sentence in the badboys.txt file.
Close both files at the end of the
The output should look similar to this:
*attached image 2*
Thank you, I really need help
Step by step
Solved in 2 steps