C++ while statement with int as controller

Description

C++ while statement with int as controller

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

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

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



PreviousNext

Related