Click here to Skip to main content
15,911,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionVisual Studio Addin for source code editor tooltip [modified] Pin
lclarsen18-May-10 1:58
lclarsen18-May-10 1:58 
QuestionMemory leak In Excel range pointer Pin
trioum18-May-10 0:53
trioum18-May-10 0:53 
AnswerRe: Memory leak In Excel range pointer Pin
Stephen Hewitt18-May-10 14:06
Stephen Hewitt18-May-10 14:06 
GeneralRe: Memory leak In Excel range pointer Pin
trioum18-May-10 22:30
trioum18-May-10 22:30 
QuestionService access file on network folder Pin
baerten18-May-10 0:39
baerten18-May-10 0:39 
AnswerRe: Service access file on network folder Pin
Garth J Lancaster18-May-10 0:52
professionalGarth J Lancaster18-May-10 0:52 
AnswerRe: Service access file on network folder Pin
Covean18-May-10 0:52
Covean18-May-10 0:52 
AnswerRe: Service access file on network folder Pin
baerten18-May-10 2:39
baerten18-May-10 2:39 
GeneralRe: Service access file on network folder Pin
sashoalm18-May-10 7:45
sashoalm18-May-10 7:45 
Questionmake a timer Pin
hasani200717-May-10 23:05
hasani200717-May-10 23:05 
AnswerRe: make a timer Pin
Rajesh R Subramanian17-May-10 23:26
professionalRajesh R Subramanian17-May-10 23:26 
JokeRe: make a timer Pin
CPallini17-May-10 23:45
mveCPallini17-May-10 23:45 
AnswerRe: make a timer Pin
Maximilien18-May-10 0:30
Maximilien18-May-10 0:30 
GeneralRe: make a timer Pin
Stephen Hewitt18-May-10 0:35
Stephen Hewitt18-May-10 0:35 
AnswerRe: make a timer Pin
KarstenK18-May-10 1:26
mveKarstenK18-May-10 1:26 
AnswerRe: Here is your count down timer hasani2007 Pin
Software_Developer18-May-10 7:31
Software_Developer18-May-10 7:31 
Sir, Here is your timer hasani2007. Its in 'dirty c code', clean it up.
set the variable count_down_time_in_secs in seconds for desired count down time.
The Code is self explanatory.

1 minute = 60 secs
5 minutes = 60x5 secs
30 minutes =60x30 secs
1 hour = 60x60 secs


#include <stdio.h>
#include <time.h>

 
int main ()
{
	 
	 
	unsigned int x_hours=0;
	unsigned int x_minutes=0;
	unsigned int x_seconds=0;
	unsigned int x_milliseconds=0;
	unsigned int totaltime=0,count_down_time_in_secs=0,time_left=0;

	clock_t x_startTime,x_countTime;
	count_down_time_in_secs=10;  // 1 minute is 60, 1 hour is 3600

 
    x_startTime=clock();  // start clock
    time_left=count_down_time_in_secs-x_seconds;   // update timer

	while (time_left>0) 
	{
		x_countTime=clock(); // update timer difference
		x_milliseconds=x_countTime-x_startTime;
		x_seconds=(x_milliseconds/(CLOCKS_PER_SEC))-(x_minutes*60);
		x_minutes=(x_milliseconds/(CLOCKS_PER_SEC))/60;
		x_hours=x_minutes/60;


	 

		time_left=count_down_time_in_secs-x_seconds; // subtract to get difference 


		printf( "\nYou have %d seconds left ( %d ) count down timer by TopCoder 

",time_left,count_down_time_in_secs);
	}


	printf( "\n\n\nTime's out\n\n\n");

return 0;
}

.
.
.

TopCoder
GeneralRe: Here is your count down timer hasani2007 Pin
Stephen Hewitt18-May-10 14:04
Stephen Hewitt18-May-10 14:04 
AnswerRe: make a timer Pin
Aescleal19-May-10 5:49
Aescleal19-May-10 5:49 
Questionrecursive function Pin
hasani200717-May-10 22:26
hasani200717-May-10 22:26 
AnswerRe: recursive function Pin
CPallini17-May-10 22:45
mveCPallini17-May-10 22:45 
QuestionRe: recursive function Pin
David Crow19-May-10 3:52
David Crow19-May-10 3:52 
Questionsingel document app cannot recieve WM_KEYDOWN event Pin
dnqhung17-May-10 21:00
dnqhung17-May-10 21:00 
AnswerRe: singel document app cannot recieve WM_KEYDOWN event Pin
Aescleal18-May-10 5:12
Aescleal18-May-10 5:12 
GeneralRe: singel document app cannot recieve WM_KEYDOWN event Pin
dnqhung18-May-10 15:33
dnqhung18-May-10 15:33 
GeneralRe: singel document app cannot recieve WM_KEYDOWN event Pin
Aescleal18-May-10 22:38
Aescleal18-May-10 22:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.