We have upgraded our system to latest version of MyBB. We are very sorry for the downtime ! Read More.
Advertise Here | Remove Ads

Do/While Yes/No HELP c++?
  • 0 Vote(s) - 0 Average

Do/While Yes/No HELP c++?
For a Do/While loop in c++ to ask if the user wants to continue or not the while statement looks like while (choice='y' || 'n') what do you write after if the user responds no?

You can use break for such option !

For example....

Do {
your codes....
if(choice == 'y'){
some code here....
else if (choice == 'n'){
break; // it will break the loop
else {
some codes here....
}while (your condition here)

When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop.


i know the if or else statement already, though i later asked a friend and he gave me another idea, i think your reply contains just a single conditional statement, my question was "what if it contains a double conditional statement like choice=[], while (choice='y'||'n') what should come next?, my friend explained to me that i could actually input my print("bla bla bla") statement which i think is correct.


Forum Jump:

Users browsing this thread:
1 Guest(s)

Advertise Here | Remove Ads