C++ examples for Statement:while
A while loop executes until its accompanying statement evaluates to false.
#include <iostream> using namespace std; int main(int argc, const char * argv[]) { unsigned int array[10]; unsigned int count = 0; while (count < 10) { //from w w w .j av a2 s.c o m array[count] = count * 2; cout << "Loop Iteration: " << array[count++] << endl; } return 0; }