What are two pretest loop statements available in C++ and why would you use one versus the other?

What will be an ideal response?


You can use a while statement or a for statement to code pretest loops. Thewhilestatement is usually used when a set of instructions should be repeated while a particular condition is true or until a condition becomes true (like a variable reaching a certain value). A for statement can be used in a similar fashion, however, the most common use of the for statement is to code counter-controlled pretest loops because it provides a more compact and clearer way of writing that type of loop.

Computer Science & Information Technology

You might also like to view...

There is a variation of the Rock, Paper, Scissors game that is played with the addition of Spock and lizard. Lizard poisons Spock and eats paper. Scissors decapitates lizard and rock crushes lizard. Spock smashes scissors and vaporizes rock. Paper disproves Spock, probably because it’s a scientific paper. Change your RPS program to also have lizard and Spock, and make sure to include images for these options as well.

What will be an ideal response?

Computer Science & Information Technology

When you add a(n) ________, you are adding a control whose source of data is an expression

Fill in the blank(s) with correct word

Computer Science & Information Technology

The ________ action is used to execute an Access command, such as Sort Ascending or Save a Record

Fill in the blank(s) with correct word

Computer Science & Information Technology

For most software programs, the licensing agreement or terms of use agreement is usually displayed and must be agreed to by the end user at the beginning of the software installation.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology