-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtwoinOne.cpp
150 lines (88 loc) · 2.19 KB
/
twoinOne.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
void displayMan(int x,int y)
{
circle(x,y,20); //face
line(x,y+20,x,y+30); //neck
line(x,y+30,x+20,y+40); //right hand
line(x+20,y+40,x+30,y+30);
line(x,y+30,x,y+70); //body
line(x+30,y+30,x+30,y-90); //umbrella
pieslice(x+30,y-30,0,180,55);
}
void displayWoman(int a,int b)
{
//line(a,b+11,a,b+10);
circle(a,b,20); //face
line(a,b+20,a,b+30); //neck
line(a,b+30,a-20,b+40); //left hand
line(a,b+30,a+20,b+40); //right hand
line(a,b+30,a,b+70); //body
}
int main()
{
int gd=DETECT,
gm,i,d=0,x=50,y=340,c=0,a=110,b=340,shouldMove=1;
int rx,ry;
initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
while(!kbhit())
{
cleardevice();
displayMan(x,340);
displayWoman(a,340);
line(0,430,639,430);
for(i=0; i<500; i++)
{
rx=rand()%639;
ry=rand()%439;
if(rx>=(x-40)&&rx<=(x+110))
if(ry>=(y-50)&&ry<=479)
continue;
line(rx-10,ry+10,rx,ry);
}
//legs For DisplayWoman
if(shouldMove)
{
if(c<20)
c+=4;
else
shouldMove=0;
line(a,b+70,a-c,b+90);
line(a,b+70,a+c,b+90);
}
else
{
if(c>0)
c-=4;
else
shouldMove=1;
line(a,b+70,a-c,b+90);
line(a,b+70,a+c,b+90);
}
delay(200);
a=(a+10)%639;
//legs For DisplayMan
if(shouldMove)
{
if(d<20)
d+=4;
else
shouldMove=0;
line(x,y+70,x-d,y+90);
line(x,y+70,x+d,y+90);
}
else
{
if(d>0)
d-=4;
else
shouldMove=1;
line(x,y+70,x-d,y+90);
line(x,y+70,x+d,y+90);
}
delay(200);
x=(x+10)%639;
}
getch();
}