Every programming language provides different features to make coding task easy. One of the main objectives is to keep things simple as possible. You have studied C++ in this course and have learnt many different concepts e.g. input/output, if-else statements, loops, arrays, functions etc.

Looping constructs are needed when a statement or a block of statement is repeatedly executed until a specific condition holds true. You have learned in this course that 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.

Your Task is to comment on the views of Mr. ABC. Clearly state your position in favor or against for each argument of Mr. ABC with justified reasons.

Member Avatar for iamthwee

Never mind about that, I want to know what Mr. ABC did for Mrs. XYZ on valentine's day?

On a serious note Google go has only one loop construct the for loop, so the while and do... while expressions are pretty much redundant.

Actually, I have found that upon occasion (though not often) a do ... while() loop has advantages over a simple for(;;) or while() construct, just as the goto statement, while deprecated in most languages, is still useful upon occasion.

A language expert Mr. ABC objects the designers of C++ on the bases of following two arguments

I suspect this 'language expert' doesn't actually write code. Orthogonality is an important concept in language design, yet even more important is sacrificing orthogonality for usability. It doesn't matter how beautiful a language is if nobody uses it.

My question is which of these available looping constructs does Mr. ABC prefer as the "only right one", and why?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.