Linked Questions

8 votes
4 answers
41k views

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)...
Kahn Kah's user avatar
  • 1,463
-3 votes
3 answers
209 views

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 ...
Artemi Kane's user avatar
-2 votes
1 answer
297 views

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,
Juje's user avatar
  • 11
-3 votes
1 answer
83 views

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; ...
kron maz's user avatar
  • 131
-2 votes
3 answers
77 views

#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"; ...
Michael45's user avatar
73 votes
36 answers
50k views

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 ...
quandrum's user avatar
  • 1,666
28 votes
31 answers
23k views

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

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 = ...
Shaz's user avatar
  • 15.9k
7 votes
12 answers
16k views

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....
AlexMTMorgan's user avatar
12 votes
3 answers
887 views

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 ...
Dog eat cat world's user avatar
0 votes
7 answers
17k views

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 ...
Mohammed H's user avatar
  • 7,068
-1 votes
6 answers
9k views

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 ...
user avatar
0 votes
0 answers
12k views

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 (...
UnkwnTech's user avatar
  • 91.4k
-3 votes
5 answers
367 views

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 ...
VickTree's user avatar
  • 909
0 votes
0 answers
2k views

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 ...
Jon Cage's user avatar
  • 37.8k

15 30 50 per page