Counter-controlled repetition. - C++ Statement

C++ examples for Statement:while

Description

Counter-controlled repetition.

Demo Code

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

Result


Related Tutorials