Question: c++ **********DRAW A FLOWCHART AND PSEUDOCODE, DO NOT WRITE THE CODE*********** **********DRAW A FLOWCHART AND PSEUDOCODE, DO NOT WRITE THE CODE*********** **********DRAW A FLOWCHART AND
c++
**********DRAW A FLOWCHART AND PSEUDOCODE, DO NOT WRITE THE CODE***********
**********DRAW A FLOWCHART AND PSEUDOCODE, DO NOT WRITE THE CODE***********
**********DRAW A FLOWCHART AND PSEUDOCODE, DO NOT WRITE THE CODE***********
Design
Flowcharts for entire programs are not always useful. However, creating a flowchart for a portion of a program can be helpful.
Draw a flowchart for your algorithm to extract individual digits from a single integer and put each digit in a list (e.g. vector).
Draw a flowchart for your algorithm to create a random code and place the code in a list (e.g. vector).
Identify test cases, especially ones not covered in the sample run but indicated in the description.
Program
This homework will be done over two weeks. Bulls and Cows is a guessing game where you try to guess a 'n' digit code. (Note: Each number in the code must be distinct.) When a number is guessed and a digit is in the correct location, then that is a bull. When a digit is in the number, but in the incorrect location, then that is a cow. So if a four-digit code is 2894, and the user guesses 4698. Then that is "1 bull and 2 cows" because '9' is in the correct location and '4' and '8' are in the code but are currently in the wrong location. The guessing continues until the code is guessed in the correct order... "4 bulls"!
This website will give you a feel for the game.http://www.mathsisfun.com/games/bulls-and-cows.html
To emulate our version, click on "Options" and select any 0-9 choice.
Requirements
Note: You are only implementing part of the code. You will complete the assignment in the next homework.
Program Flow
Get the number of digits of the code.
Only accept inputs of 0, 3, 4, or 5. (Note: 0 is a cheat code)
Repeat until a valid choice is an input.
Load vector with code digits
If 0 is input a number of digits for the code: (Note: This will allow TAs/autograding to enter a code to make testing easier. Since this is for testing purposes, you do not have to check these for correct input.)
Get code as a single integer (int).
Get the number of digits for the code. (Note: You need this so you can add a leading zero if needed, e.g. they type in 29 and you need to create 029.)
Extract individual digits from the single integer and put into the vector for the code. Consider using integer division and modulus.
Else randomly create a valid code. (i.e. number of digits was 3, 4 or 5)
Load vector with the appropriate number of random digits ensuring there are no duplicates.
Regardless of the method, you used to create the code (entered from the keyboard or randomly generated), output the code to be guessed. (This is purely to help with auto-grading. Of course in a published game you would not output the code.)
Note: Be sure to match the output of the sample runs.
Coding Requirements
The code and guess must each be stored in a vector of ints.
Follow formatting as demonstrated in the "Sample Runs" below.
Sample Runs
This is not complete testing!
Enter number of digits in code (3, 4 or 5): 0 Enter code: 2894 Enter number of digits in code: 4 Number to guess: 2894 Enter number of digits in code (3, 4 or 5): 0 Enter code: 29 Enter number of digits in code: 3 Number to guess: 029
Enter number of digits in code (3, 4 or 5): 5 Number to guess: 48502
Enter number of digits in code (3, 4 or 5): 3 Number to guess: 072
**********DRAW A FLOWCHART AND PSEUDOCODE, DO NOT WRITE THE CODE***********
**********DRAW A FLOWCHART AND PSEUDOCODE, DO NOT WRITE THE CODE***********
**********DRAW A FLOWCHART AND PSEUDOCODE, DO NOT WRITE THE CODE***********
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
