-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
65 lines (51 loc) · 1.27 KB
/
main.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <graphics.h>
#include <conio.h>
int main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
int x = 200;
int y = 200;
int direction = 1;
while (TRUE)
{
cleardevice();
setcolor(WHITE);
circle(x, y-100, 20);
setcolor(WHITE);
rectangle(x - 20, y-80, x + 20, y);
setlinestyle(SOLID_LINE, 0, 3);
setcolor(WHITE);
line(x - 60, y-100, x-20, y-65);
line(x + 60, y-100, x+20, y-65);
circle(x-63,y-105,8);
circle(x+63,y-105,8);
setlinestyle(SOLID_LINE, 0, 3);
setcolor(WHITE);
line(x - 10, y, x-25, y+80);
line(x + 10, y, x+25, y+80);
circle(x-24,y+88,8);
circle(x+24,y+88,8);
delay(100);
x+=20*direction;
if (kbhit())
{
char key = getch();
switch (key)
{
case 75:
direction = -1;
break;
case 77:
direction = 1;
break;
}
}
if (x > getmaxx())
x = -40;
else if (x < -40)
x = getmaxx();
}
closegraph();
return 0;
}