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.

Recommended Answers

All 2 Replies

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;

@zortec:thank u very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.