Question: Trying to create a program to keep track of the Dallas Cowboys wins and losses for this season. This code will require #include Create a
Trying to create a program to keep track of the Dallas Cowboys wins and losses for this season. This code will require
#include
Create a C/C++ that does the following:
- Create a method that will allow you to enter the win and losses. Enter W for a win and L for a Loss.
- Hint: This method needs to have a vector passed by reference (&) to it.
- Using a loop - prompt for the Win or Loss and add the given value to the passed vector. Allow the entry 'X' to end the input.
- Create a method to report the total wins and total losses. It needs to have a char vector passed to it.
- You will need to create a variable to count the number of wins and a variable to count the number of losses.
- Initialize these variables to zero.
- Using a loop - transverse the vector and increment your counters as data qualifies.
- Report the total wins and total losses.
- In the main method
- Create a vector of characters.
- Call the method created in Step 1 and pass it the vector created in Step 3.1
- Call the method created in Step 2 and pass it the vector created in Step 3.1
- Display "Done!"
This is an example run:
Enter Win(W) or Loss(L) or X: W Enter Win(W) or Loss(L) or X: W Enter Win(W) or Loss(L) or X: L Enter Win(W) or Loss(L) or X: W Enter Win(W) or Loss(L) or X: W Enter Win(W) or Loss(L) or X: L Enter Win(W) or Loss(L) or X: X Win count is 4 - Loss Count is 2 Done!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
