Contoh :
int x;
x = 1;
while (x <10)
{
//body of the loop
cout <<x<<endl;
//counter statement to increase x
x=x+1;
}
- number 10 will not appear on the screen, because the control variable will stop when it comes to number 10. whereas when x = 10, then will return the value FALSE.
Leave reply