Please provide a context as your question is otherwise impossible to answer adequately.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>they let you run the program over and over again.
Interesting interpretation.
>a while loop is a loop where if the condition is met it will
>keep doing what inside the loop over and over again.
>a do while loop does whats inside then if a
>condition is met it does it again and again.
What a fantastic way to confuse people.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
'Advantages'? It depends on what you mean with it ...
They're both used to repeat a chunk of code as long as a condition is true, but using do-while, your code is executed one time at least ...
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
I am surprised that the OP is not even participating in the discussion!
Anyway, if the OP bothers to see this thread, here is somewhat explanation from my side:
There are three loops in C,C++ namely while, do-while and for. Let this be clear in your mind that each loop, can be (theoretically) used instead of the other. So, why invent three loops in the first place? The answer may lie in 'comfort'. That is, each loop designed to help you in different situations. No loop is 'superior' than other.
So, in short, there are ADVANTAGES of each loop in its own domain.
The applications of each loop is too trivial and hence I am omitting it here.
Hope this helps!
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
>wanna tell me which part is gonna confuse people so i can better explain it?
Let's see...maybe...possibly, the part where you answered a completely different question from the one that was asked. The OP asked what the advantages of the two loops are (with advantages in all caps, I might add, so not really easy to miss).
>or could i just be confusing you o.0
You're welcome to try. Usually people around here only manage to confuse me with incredible stupidities.
>i have seen you post around. i wont waste my time with you.
What a shame. I'm sure it would be quite entertaining if you went on a quest to bring me down. People who do that are always good for a few weeks of amusement.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401