A while loop executes until its accompanying statement evaluates to false. - C++ Statement

C++ examples for Statement:while

Description

A while loop executes until its accompanying statement evaluates to false.

Demo Code

#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; 
}

Result


Related Tutorials