C++ examples for Statement:while
Counter-controlled repetition.
#include <iostream> int main(int argc, const char *argv[]) { int counter = 1; while (counter <= 10) { std::cout << counter << " "; ++counter;/*from www. j a v a 2 s . c om*/ } std::cout << std::endl; return 0; }