Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C++ pieslice() - Draw and Fills Circle or Piece of Circle



In C++, the pieslice() Function is used to draw and fills a slice of pie starting from a specified angle and up to another specified angle, along the fixed centered point (x, y) with specified radius.

Syntax of pislice() Function

The general syntax of this function looks like this:


pieslice(x, y, s_angle, e_angle, radius);
Where:
x and y represent centered point of the pie slice. These are x-coordinate and y-coordinate of the center of pie slice on the screen.
s_angle It represents the starting angle of the arc in degree.
e_angle It represents the ending angle of the arc in degree.
radius It represents radius of the pie.

Each of the above mentioned parameter can be a constant or variable of "int" data type.

This function can also be used to draw a circle and line. If you want to draw a circle, give the starting angle 0° and ending angle 360°.

In the same way, a line can be draw with this function by giving same values to starting and ending angles.

Example of pieslice() Function

The following C++ program draws a circle using this function.


#include
#include
#include
using namespace std;
main()
{
int d, m, n;
d = DETECT;
initgraph (&d, &m, " ");
cleardevice();
pieslice(300, 200, 0, 360, 90);
getch();
closegraph();
}


This post first appeared on Programming Explain, please read the originial post: here

Share the post

C++ pieslice() - Draw and Fills Circle or Piece of Circle

×

Subscribe to Programming Explain

Get updates delivered right to your inbox!

Thank you for your subscription

×