Question: Goal: Use a while loop to perform an input validation Assignment: Imagine you are creating a puzzle game. One of the puzzles requires the player

Goal: Use a while loop to perform an input validation
Assignment: Imagine you are creating a puzzle game. One of the puzzles requires the player to find the combination to open a lock.
Write some code that reads the user input from the keyboard, and checks that the number they provided is the same as secretCode, an it
variable that has already been declared and assigned a value. Keep asking the user to input a value until they match the secretCode.
For example, if the secret code was 1234: (user input within square brackets)
[1111]
Wrong code
[5123]
Wrong code
[0]
Wrong code
[1234]
Correct!
Note: Write the lines of code necessary to capture and validate only the user input. You do not need to write a complete program. In c++
Goal: Use a while loop to perform an input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!