-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCircle.cpp
More file actions
54 lines (52 loc) · 999 Bytes
/
Circle.cpp
File metadata and controls
54 lines (52 loc) · 999 Bytes
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
#include <iostream>
#include<dos.h>
#include<graphics.h>
#include<math.h>
using namespace std;
void rendercircle (int circx, int circy, int r,int j)
{
int x=0,y=r;
int p;
p=1-r;
int i=j%8;
for(;x<=y;)
{
putpixel(y+circx, x+circy,1);
putpixel(x+circx, y+circy,2);
putpixel(x+circx, -y+circy,3);
putpixel(-y+circx, x+circy,4);
putpixel(-y+circx, -x+circy,5);
putpixel(-x+circx, -y+circy,6);
putpixel(y+circx, -x+circy,7);
putpixel(-x+circx, y+circy,8);
if(p<0)
{
x=x+1;
y=y;
p=p+2*x+1;
}
else
{
x=x+1;
y=y-1;
p=p+2*x-2*y+1;
}
}
}
int main()
{
int r,i;
cout<<"Enter radius::";
cin>>r;
initwindow(800,800);
for(int i=1;i<r;i++){
for(int j=r-5;j<r;j++)
{
rendercircle(500,500,j,i);
}
delay(1000);
}
getch();
closegraph();
return 0;
}