Arc in c graphics


Arc in c graphics

arc(
) :

It draws a circular arc in the current drawing color.

Syntax :


arc(int x,int y,int stangle,int endangle,radius);

(x,y)---centre point of arc

stangle---starting angle

endangle---ending angle

Note : If starting angle=0 and ending angle=360 then a circle is formed.

Example :

#include <graphics.h>
#include <conio.h>

void main()
{
clrscr();


int d,m;
int x,y,r;
int sangle,eangle;
int midx;
int midy;


printf("Enter x axis:");
scanf("%d",&x);

printf("Enter y axis:");
scanf("%d",&y);

printf("Enter radius:");
scanf("%d",&r);

printf("Enter starting angle:");
scanf("%d",&sangle);

printf("Enter ending angle:");
scanf("%d",&eangle);

d=DETECT;

initgraph(&d,&m,"c:\\tc\\bgi");

arc(x,y,sangle,eangle,r);

midx=getmaxx()/2;
midy=getmaxy()/2;

ellipse(midx,midy,sangle,eangle,x,y);


getch();
closegraph();
}

Output :

0 comments:

Post a Comment