Looping constructs are needed when a statement or a block of statement is repeatedly executed until a specific condition holds true. C++ provides three looping constructs; For Loop, While Loop and Do-while Loop.
For C++ designers, it is not easy to include a construct or structure while developing this computer language. On the other hand, it also increases the complexity for learners as languages with more construct are difficult to learn.
A language expert Mr. ABC objects the designers of C++ on the bases of following two arguments:
· A single looping construct is sufficient to cover all types of situations.
· Designers of C++ have not done any good with themselves and C++ programmers by making things complex with provision of three different looping constructs.
The purpose of a high level language is to make it easy for a person to tell a computer what to do. Although a single looping construct would be sufficient for the computer, C++'s 3 constructs make it easier on the person by letting them express their intent. This is good when writing code, but even more important when maintaining it.
The do-while loop tells us that the person wants the loop to execute at least once. The while loop tells us that it might be skipped altogether. The "for" loop lets us isolate the looping logic from the code that executes during each iteration.
I use the "for" loop most often, and not just for simple counter loops. Most loops really do have some sort of setup logic, a loop test, and a step to move you to the next iteration. If a loops has at least 2 of these 3, then I use the
I don't think that 3 different loop types is all that overwhelming. When starting a game loop, I tend to use the 'while' loop, and then for most other situations I use the 'for' loop. I almost never use the 'do-while' loop, but for some reason I find it comforting that it is still there as an option should I desire it. :)
It sounds to me like the question you are trying to ask is not translating to English very clearly. But from what I read it seems very opinionated. Some might really feel that one loop type could be used to cover all situations, while others would not.
Mr. ABC for example would prefer only one loop type.