Monday, 8 July 2013

Counter in C++

#include<iostream.h>
#include<conio.h>

void main()
{
    clrscr();
    int a = 0;
    char quit;
    cout<<"\n\n--------------------------------\n";
    cout<<" Counter (Hit any key to count)\n";
    cout<<"--------------------------------\n\n";
    gotoxy(1,12);
    cout<<"--------------------------------\n";
    cout<<" Press \"q\" to quit ";
    while(quit != 'q' && quit != 'Q')
    {   
        gotoxy(16,8);
        cout<<a;
        a++;
        quit = getch();
    }   
}

No comments:

Post a Comment