-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIGNAL-1.C
81 lines (81 loc) · 1.35 KB
/
SIGNAL-1.C
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void red()
{
setcolor(BROWN);
rectangle(50,50,150,150);
rectangle(50,150,150,250);
rectangle(50,250,150,350);
setcolor(RED);
setfillstyle(SOLID_FILL,RED);
circle(100,100,50);
floodfill(100,100,RED);
outtextxy(150,100," STOP!!");
}
void yellow()
{
setcolor(BROWN);
rectangle(50,50,150,150);
rectangle(50,150,150,250);
rectangle(50,250,150,350);
setcolor(YELLOW);
setfillstyle(SOLID_FILL,YELLOW);
circle(100,200,50);
floodfill(100,200,YELLOW);
outtextxy(150,200," GET READY!!");
}
void green()
{
setcolor(BROWN);
rectangle(50,50,150,150);
rectangle(50,150,150,250);
rectangle(50,250,150,350);
setcolor(GREEN);
setfillstyle(SOLID_FILL,GREEN);
circle(100,300,50);
floodfill(100,300,GREEN);
outtextxy(150,300," GO!!!");
}
void count()
{
int i;
for(i=10;i>0;i--)
{
printf("%d",i);
printf("->");
delay(1000);
}
printf("\n");
}
void main()
{
int gd=DETECT, gm, num, i;
initgraph(&gd,&gm, "C:\\turboc3\\bgi");
clrscr();
printf("Enter a number 1,2 or 3:\n");
scanf("%d", &num);
if(num==1)
{
count();
red();
}
else if(num==2)
{
count();
yellow();
}
else if(num==3)
{
count();
green();
}
else
{
textcolor(RED+BLINK);
cprintf("Invalid entry");
}
getch();
closegraph();
}