while statement! help!

Hey guys, im new with the C++ program. I need help with this question about while statement, cus i have no clue about it.

For the following C++ program :

#include <iostream>
using namespace std;

int main()
{
int num = 0;
while (num <= 20)
{
num++;
cout << num << " ";
}

return 0;
}

determine the total number of items displayed, and the first and last numbers printed. Draw the flow chart for the C++ program, and then desk-check the program for the first 5 steps and the last 3.
just compile and run it and see the results :\

though this seem like a test question, in that case, fuggedaboutit
^^ it looks just fine.
num's value starts at 0. Every time the while loop runs, num is incremented by one (1 is added to it), and it displays the value of num. The loop will run until num is larger or equals 20.

I'm not sure if this actually helped, but if it is something specific that you don't understand, just ask!
Last edited on
Topic archived. No new replies allowed.