Linked Questions
19 questions linked to/from 'do...while' vs. 'while'
8 votes
4 answers
41k views
The difference between while and do while C++? [duplicate]
I would like someone to explain the difference between a while and a do while in C++ I just started learning C++ and with this code I seem to get the same output: int number =0; while (number<10)...
-3 votes
3 answers
209 views
While Loop vs Do While Loop [duplicate]
I am working on a program in C++ for my class to prepend, append, insert, display items of a circular-list. I came across while loop functioning differently then a do-while loop for what to my mind ...
-2 votes
1 answer
297 views
what is the difference between while and do-while loop in c? [duplicate]
I am new to programming language. Anyone please help me with this. It helps to improve my skills. what is the difference between while and do-while loop in c Thank You,
-3 votes
1 answer
83 views
confused as to whether to use a do-while or while loop for dice game [duplicate]
Wanted to know whether a for-loop is better or if I should stick with a while loop. And if so why or why not. srand((unsigned) time(NULL)); bool result; bool end = false; int win, lose; char answer; ...
-2 votes
3 answers
77 views
Why does my conditional code execute when my conditional statement isn't true in my do-while loop? [duplicate]
#include<iostream> #include<string> using namespace std; int main() { const int SIZE=7; string tuition[SIZE]; tuition[0]="Student ID"; tuition[1]="total financial aid recieved"; ...
73 votes
36 answers
50k views
How can I print a list of elements separated by commas?
I know how to do this in other languages, but not in C++, which I am forced to use here. I have a set of strings (keywords) that I'm printing to out as a list, and the strings need a comma between ...
28 votes
31 answers
23k views
Test loops at the top or bottom? (while vs. do while) [closed]
When I was taking CS in college (mid 80's), one of the ideas that was constantly repeated was to always write loops which test at the top (while...) rather than at the bottom (do ... while) of the ...
11 votes
6 answers
16k views
The do-while statement [duplicate]
Possible Duplicate: When is a do-while appropriate? Would someone mind telling me what the difference between these two statements are and when one should be used over the other? var counterOne = ...
7 votes
12 answers
16k views
When would a do-while loop be the better than a while-loop?
This is a highly subjective question, so I'll be more specific. Is there any time that a do-while loop would be a better style of coding than a normal while-loop? e.g. int count = 0; do { System....
12 votes
3 answers
887 views
Python equivialent of C programming techniques (while loops)
In the C programming language, I often have done the following: while ((c = getch()) != EOF) { /* do something with c */ } In Python, I have not found anything similar, since I am not allowed to set ...
0 votes
7 answers
17k views
Which loop is faster in C? while loop or do-while loop [closed]
Some situation, we can use while loop or do-while loop interchangeably. One of my friend told me that such situation we should use do-while loop. Because it is faster than while. Can anyone give me ...
-1 votes
6 answers
9k views
Difference in while and do-while loops
Can someone explain the purpose of having two different types of while loops? I am new to programming. Also supply example situations with the proper while loop if possible. I understand how to use a ...
0 votes
0 answers
12k views
While vs. Do While
I've seen both the blocks of code in use several different times, personally I have always used the first but my question is: is there a functional difference, and if there is what is it? while (...
-3 votes
5 answers
367 views
Understanding do/while loop C++
I do not understand how this loop repeats when the user inputs 'Y'. All of the code is in the "do" part; and the do part repeats once? After that while statement is just a return statement. int ...
0 votes
0 answers
2k views
When should I use do-while instead of while loops? [duplicate]
Possible Duplicates: Is there ever a need for a “do {…} while ( )” loop? Do your loops test at the top or bottom? While vs. Do While When is a do-while appropriate? I've ...