Question: In this exercise, you'll modify the while loop in the Guess the Number application so it doesn't use the break or continue statements. Open and

In this exercise, you'll modify the while loop in the Guess the Number application so it doesn't use the break or continue statements.
Open and run the project
Open the project named ch04_ex3_GuessNumber that's stored in the ex_starts folder. Then, run the application to see how it works.
Remove the break statement
2. Modify the while loop so its Boolean expression checks that the guess and number variables aren't equal. To do that, you need to declare the guess variable outside the loop.
3. Move the statement that notifies the user of the correct guess so it executes after the while loop is finished.
4. Delete the else clause of the if/else statement.
5. Move the code that increments the counter variable so it's only executed if the guess is too high or too low, not if the guess is the correct number.
6. Run the application and test it to make sure it still works correctly.
 In this exercise, you'll modify the while loop in the Guess

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 Databases Questions!