answersLogoWhite

0

char YorN; //I named this after Yes or No

do

{

cout<< "Do you want to continue (Y/N)? "; //You have to answer this with a 'Y' or 'N' to continue

cin >> YorN;

}

while((YorN !='Y')&&(YorN !='N')&&(YorN !='y')&&(YorN !='n')); //This ends the program when the user has -

entered either of these characters: 'Y', 'y', 'N', 'n'.

//The while keeps activating until YorN equals 'Y', 'y', 'N', 'n'.

I hope this has helped you! :D

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
JudyJudy
Simplicity is my specialty.
Chat with Judy
More answers

from:

while (exp) stmt

to:

for (;exp;) stmt

User Avatar

Wiki User

13y ago
User Avatar

while (1) puts ("press Ctrl+C");

User Avatar

Wiki User

13y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program using do while loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp