C++ examples for Statement:while
Demonstrate WHILE loop
#include <iostream> using namespace std; int main()/*w ww . jav a2 s. c o m*/ { int n = 99; // make sure n isn't initialized to 0 while( n != 0 ) // loop until n is 0 cin >> n; // read a number into n cout << endl; return 0; }