-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.c
98 lines (77 loc) · 1.68 KB
/
circle.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<math.h>
union REGS i, o;
int initmouse()
{
i.x.ax = 0;
int86(0X33, &i, &o);
return ( o.x.ax );
}
void showmouseptr()
{
i.x.ax = 1;
int86(0X33, &i, &o);
}
void hidemopuseptr()
{
i.x.ax = 2;
int86(0X33, &i, &o);
}
void getmousepos(int *x, int *y)
{
i.x.ax = 3;
int86(0X33, &i, &o);
*x = o.x.cx;
*y = o.x.dx;
}
void movemouseptr(int x, int y)
{
i.x.ax = 4;
i.x.cx = x;
i.x.dx = y;
int86(0X33, &i, &o);
}
main()
{
int gd = DETECT, gm, midx, midy, radius, x, y, tempx, tempy;
radius = 100;
initgraph(&gd, &gm, "C:\\TC\\BGI");
if(!initmouse())
{
closegraph();
exit(1);
}
midx = getmaxx()/2;
midy = getmaxy()/2;
showmouseptr();
movemouseptr(midx, midy);
circle(midx, midy, radius);
x = tempx = midx;
y = tempy = midy;
while(!kbhit())
{
getmousepos(&x, &y);
if((pow(x-midx,2)+pow(y-midy,2)-pow(radius,2))>0)
{
movemouseptr(tempx, tempy);
x = tempx;
y = tempy;
}
tempx = x;
tempy = y;
}
closegraph();
return 0;
}
/*
👋 Hi, I’m @aarushinair - Aarushi Nair (she/her/ella)
👀 I’m a Computer Science Engineering Student
💞️ I’m looking to collaborate on #java, #python, #R, #applicationdevelopment
🌱 #GirlsWhoCode #WomenInTech #WomenInIT #WomenInSTEM #CyberSecurity #QuantumComputing #BlockChain #AI #ML
📫 How to reach me: https://www.linkedin.com/in/aarushinair/
👩🏫 YouTube Channel - Code with Aarushi : https://www.youtube.com/channel/UCKj5T1ELHCmkGKujkpqtl7Q
🙋 Follow me on Twitter: https://twitter.com/aarushinair_
*/