Program to make "Pieslice" without using library function? As we know in C/C++ there is "graphics.h" header file with the help of which we can do graphics programs in C. 
There is a function pieslice in that header file,its syntax is:

#include &lt;graphics.h&gt;

void pieslice(int x, int y, int stangle, int endangle, int radius);


[x,y are the center of the circle,stangle and endangle are the starting and end angles respectively]

Can we make a pieslice in C/C++ without using this in-built function.Please help. Tried making it with the help of the lines and arc function of the 
graphics.h but i am still not able to figure out how to connect the lines with the arc. 
Thank You in advance.

My code so far:

#include&lt;stdio.h&gt;
#include&lt;graphics.h&gt;
#include&lt;math.h&gt;

int main()
{
    int gd=DETECT,gm;
    initgraph(&amp;gd,&amp;gm,NULL);
    int xc,yc,r,st_angle,ed_angle,StartX,StartY;
    printf("Enter the centers of pieslice:\n");
    scanf("%d %d",&amp;xc,&amp;yc);
    printf("Enter the radius:\n");
    scanf("%d",&amp;r);
    printf("Enter the starting angle:\n");
    scanf("%d",&amp;st_angle);
    printf("Enter the end angle:\n");
    scanf("%d",&amp;ed_angle);

    double startRadians = (double)st_angle * M_PI /180.0;
    double endRadians = (double)ed_angle * M_PI /180.0;

    for(int k=0; k&lt;startRadians;k++)
    {   
        startX = xc+ cos(startRadians) * r;
        startY = yc+ sin(startRadians) * r;
    }
    for(int l=o; l&lt;endRadians; l++)
    {
        endX = xc+ cos(endRadians) * r;
        endY = yc+ sin(endRadians) * r;
    }
You can use the sine and cosine functions to do this. Normally they start on the x axis and rotate counter-clockwise. The start point can be found by calculating:

startX = x + cos(startRadians) * radius;
startY = y + sin(startRadians) * radius;


Likewise the ending coordinates are:

endX = x + cos(endRadians) * radius;
endY = y + sin(endRadians) * radius;


Note that sin() and cos() take their parameters in radians. Given that stangle and endangle are integers, I'm guessing they're probably in degrees so you'll need to convert them by doing something like:

double startRadians = (double)stangle * M_PI / 180.0;


etc.

If you want to draw the entire pie wedge, you'll need to iterate from the start angle to the end angle and calculate every n degrees along the curve.