Pieslice() Function

pieslice() function is just like the arc() function of graphics.h header file but there is one basic difference between both the functions that is arc() is a function which does not fill anything and just draw the arc with start angle and end angle but in other side pieslice() is a function which is used to fill the color in the pieslice. You can do so with setfillstyle() function.

Declaration

void pieslice(int x, int y, int stangle, int endangle, int radius);
  • pieslice() function contains five parameter that are X-coordinate, Y coordinate, start angle, end angle and radius of the pieslice.
  • One can also draw a circle by using pieslice() function for this start angle must be 0 and end end angle must be 360.Parameter string specifies the string which is going to be display on the screen.
  • For better understanding go through the program:

Program

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT, gm;

initgraph(&gd,&gm," ");

pieslice(320,240,0,75,100);

getch();

closegraph();

}

Above program is used to draw a pieslice of radius 100 cm with start angle 0 and end angle 75 degree at position (320,240). The pieslice would be filled with the white color because white color is default color. We can also draw filled circle with the help of pieslice() function by putting start angle 0 and end angle360 degree.

Output

c graphics