Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions