To draw a sector

//To draw a sector

#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<math.h>
void main()
{
int x,y,r,i,h,k,s,g;
cout<<“\n\t\t\t\*To draw a sector*\n”;
cout<<“\nenter the x and y coordinates:-\n”;
cin>>h>>k;
cout<<“\nenter the radius:-\n”;
cin>>r;
x=s=0;
y=g=r;
int gd=DETECT,gm;
initgraph(&gd,&gm,””);
setbkcolor(WHITE);
setcolor(8);
while(x<=y)
{
putpixel(x+h,y+k,8);
x++;
y=sqrt((r*r)-(x*x));
}
setcolor(8);
line(h,k,x+h,y+k);
line(h,k,s+h,g+k);
setcolor(8);
outtextxy(100,60,” sector”);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *