Write the code using a while loop that will keep asking the user for integers until they enter a positive one.

What will be an ideal response?


int x;
cout << “Enter a positive number: “;
cin >> x;
while (x <= 0)
{
cout << “Enter a positive number: “;
cin >> x;
}

Computer Science & Information Technology

You might also like to view...

?Which of the following is true of inserting graphics in a PowerPoint presentation?

A. ?A graphic is less effective than words for communicating an important point. B. ?When you insert a graphic in a PowerPoint slide, you have to set text-wrapping options like you do in Word. C. ?Judicious use of graphics and multimedia elements can clarify points for audience members. D. ?A graphic in a PowerPoint slide cannot be dragged.

Computer Science & Information Technology

You can rearrange the toolbars and panels by opening, moving, maximizing, or closing them as you work in Expression Web.

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

Computer Science & Information Technology

The process of saving a Word document has changed radically in Word 2010.

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

Computer Science & Information Technology

Referring to the figure above, the second number in the ScreenTip (90px) indicates the ____ of the text area.

A. characters B. size C. height D. width

Computer Science & Information Technology