Loops
So I'm still learning C++ and I came upon loops,
I get the all the loops but I'm just questioning if I really understand it.
The for loop:
[Highlight=c++]for (variable-your-using; test-condition; how-it-updates-itself)
{
body;
}[/Highlight]
Example:
[Highlight=c++]for (int i = 0; i < 10; i++)
{
cout << i;
}[/Highlight]
The while loop:
[Highlight=c++]variable-your-using;
while (test-condition)
{
body;
}[/Highlight]
Example:
[Highlight=c++]int i = 0;
while (i == 0)
{
cout << i;
}[/Highlight]
and the do while loop:
[Highlight=c++] variable-your-using;
do
{
body;
} while(test-condition);[/Highlight]
Example:
[Highlight=c++]int i = 0;
do
{
cout << i;
} while(i == 0);[/Highlight]
So this is right?
And if this is right, what's the functional difference between the while, and the do while loop?