C++ for statement as while loop

Description

C++ for statement as while loop

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

int main(int nNumberofArgs, char* pszArgs[])
{
    int nLoopCount;
    cout << "Enter loop count: ";
    cin  >> nLoopCount;// w w w. ja va 2s .c o m

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



PreviousNext

Related