0

hey

just wondering how i can make a countdown timer in a windows forms app

or just how to display an updating value onto the form.

wanted to make a countdown for number of seconds the user inputs.

thnx.

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by pointin
0

You should try to search the forum before asking for help.

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


using namespace std;

int main()

{

int m, s,h;

cout << "A COUNTDOWN TIMER " << endl;
cout << "enter time in hours here" << endl;
cin >> h;
cout << "enter time in minutes here " << endl;
cin >> m;

cout << "enter im in seconds here" << endl;
cin >> s;

cout << "Press any key to start" << endl;

cout << " A COUNTDOWN TIMER" << endl;
cout << "time remaining" << endl;
cout << "hours : " << h << "mins : " << m << " secs : " << s << endl;

for (int hour = h; hour >= 0; hour--)
{
for (int min = m; min >= 0 ; min--)
{
if ( min == 0 && h > 0)
m = 59;
for (int sec = s; sec >= 0; sec--)
{
if ( sec == 0 )
s = 59;
Sleep(1000);
system("cls");
cout << hour << " :hours " << min << " :mins " << sec << " :secs" << endl;
}
}
}

Sleep(1000);
cout << "THE END" << endl;


return 0;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.