arc

Overview :

This function is used to draw the arc in the graphics mode.We can even draw a complete circle using this function.

Syntax :
void arc(int x,int y,int stangle,int endangle,int radius);
Description :
The "arc" function accepts 5 parameters
  • x -> The x co-ordinate of the screen where the center of arc has to be drawn

  • y -> The y co-ordinate of the screen where the center of arc has to be drawn

  • stangle -> This parameter is used for starting angle of the arc which ranges from 0-360 deg.

  • endangle -> This parameter is used for end angle of the arc which also ranges from 0-360 deg.

  • radius -> This parameter is used for giving radius of the arc


To draw a cirle from this "arc" function we need to set stangle = 0 and endangle = 360.

"arc" function does not return any value.
Example :
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main()
{
    
   int gm,gd=DETECT;
   int x,y,stangle,endangle,radius;
   
   printf("\nEnter the (x,y) co-ordinate : ");
   scanf("%d%d",&x,&y);
   
   printf("\nEnter the starting and ending angle : ");
   scanf("%d%d",&stangle,&endangle);
   
   printf("\nEnter the radius : ");
   scanf("%d",&radius);
   
   initgraph(&gd,&gm,"C:\\turboc3\\bgi");
   setcolor(10);
   
   arc(x,y,stangle,endangle,radius);
   
   getch();
   closegraph();
   return 0;
}


Here,the stangle and endangle given are 0 and 270 respectively.

Comments

comments powered by Disqus