Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
write a c++ code for displaying a digital clock
Posted
Comments
DAROGHE 7-Jan-13 9:14am    
#include<stdio.h>

#include<conio.h>

#include<dos.h>

#include<graphics.h>

#include<stdlib.h>

void main()

{

int i=23,j=58,k,l,a=2;

mat:

for(;;i++)

{

for(;j<60;j++)

{

for(k=0;k<60;k++)

{

l=1;

printf(“%d:%d:%d”,i,j,k);

printf(“\nTo exit Press Q”);

sleep(l);

clrscr();

if(i==23&&j==59&&k==59)

{

i=0;

j=0;

k=0;

goto mat;

}

}

}

}

max:

getch();

}

No.

My reasons:

1. There are plenty of programs that do just this already (see solutions above
2. We don't do assignments for other people - we are here to help with real problems
3. We don't do homework, as that is not helpful to the student. If a student cannot solve a problem by himself, then he doesn't learn, and will always be forced to ask for help rather than work on their own.

Too bad I can't delete the solutions already provided. But if you really wish to learn, ignore them and try it yourself. Programming is the only way to learn programming!
 
Share this answer
 
Comments
CPallini 20-Jan-12 5:23am    
I agree on: 'Programming is the best way to learn programming', however, enforcing the statement with 'other answers removal' looks a bit drastic to me.
:-)
Have my 5.
Stefan_Lang 20-Jan-12 5:35am    
enforcing the statement with 'other answers removal'
One can always dream ;o)
dclock-example
and why not you try google first for these type of questions.
Lots of Google Results
 
Share this answer
 
Here is one - CClockST v1.3[^]
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900