Print Count Down Timer in CPP

In this C++ Program, the user needs to enter a value to start the count down process. Used while loop to repeat the decrement of the count down timer. Used windows.h header file.

#include 
#include 
using namespace	std;
int main()
{
    int	timer;
    cout << "Set the Number for Count Down Timer :";
    cin	>> timer;
    while(timer>0)
    {
        cout << timer <<endl;
        Sleep(1000);
        --timer;
    }
    cout << "Time is over Buddy :)\n";
    return 0;
}

OUTPUT:

1
2
3
4
5
6
7
<br>Set the Number for Count Down Timer :5
5
4
3
2
1
Time is over Buddy :)

Leave a Reply

Your email address will not be published.