C++ examples for Statement:while
Use bool value to control while
#include <iostream> using namespace std; int main()// ww w.j av a2 s.c o m { int i = 0; bool done = false; while (!done) { cout << i << endl; i++; if (i == 10) done = true; } cout << "All Finished!" << endl; return 0; }