-
Notifications
You must be signed in to change notification settings - Fork 10
/
DIGITALC.CPP
51 lines (43 loc) · 1.02 KB
/
DIGITALC.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
struct time t;
void display(int,int,int);
void main()
{
int i=0,gd=DETECT,gm,hr,min,sec;
clrscr();
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
setcolor(GREEN);
settextstyle(4,0,7);
while(!kbhit())
{
gettime(&t);
hr=t.ti_hour;
min=t.ti_min;
sec=t.ti_sec;
i++;
display(100,100,hr);
display(200,100,min);
display(300,100,sec);
sound(400);
delay(30);
nosound();
delay(930);
cleardevice();
}
getch();
}
void display(int x,int y,int num)
{
char str[3];
itoa(num,str,10);
settextstyle(4,0,7);
outtextxy(180,100,":");
outtextxy(280,100,":");
outtextxy(x,y,str);
rectangle(90,90,380,200);
rectangle(70,70,400,220);
outtextxy(90,250,"Digital Clock");
}