For loop count - C++ Statement

C++ examples for Statement:for

Description

For loop count

Demo Code

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    int nLoopCount;
    cout << "Enter loop count: ";
    cin  >> nLoopCount;/* w ww. jav a  2s.  c  om*/

    for (; nLoopCount > 0;){
        nLoopCount = nLoopCount - 1;
        cout << "Only " << nLoopCount << " loops to go" << endl;
    }
    return 0;
}

Result


Related Tutorials