C++ examples for Statement:while
Multiples of 2 with an Infinite Loop
#include <iostream> int main(int argc, const char *argv[]) { int num = 2;//from www .j a v a 2 s .com while (true) { std::cout << num << std::endl; num *= 2; if( num > 400){ break; } } return 0; }