Jump to content
Hash, Inc. - Animation:Master

C++ 2023 Week 9


robcat2075

Recommended Posts

  • Hash Fellow

Lesson 18 While Loops

Finally, we can make a program repeat steps!

Project idea:

John Purcell suggests a program that uses a while loop to do something a number of times. But that's lame, that's what For loops are for.

How about... implement the "Price Is Right" guessing game, where the user enters a guess at a secret number, then the computer answers "High" or "Low" or "Correct". Repeat that while the user has not yet guessed the secret number.

 

Lesson 19 Do While Loops

Do While is ideal for situation where some condition isn't tested or step isn't done until you are in the loop and that step or test needs to be repeated until it meets some condition.

How about a password checker? Just to be clever, make it ask for and check two passwords and require they both be correct.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...