C Program to Draw Pie Chart

Create/ generate Pie chart using C Program


This C Program will generate Pie chart into three part. This pie chart was draw by using graphics.h in c coding. Just use the below code once you run this code it will draw the pie chart.

/* Program to draw a pie chart */

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

int main()
{
int gd = DETECT, gm;
int midx, midy;

initgraph(&gd, &gm, "C:\TC\BGI");

setcolor(MAGENTA);
rectangle(0,40,639,450);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
setcolor(WHITE);
outtextxy(275,10,"Pie Chart");

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

setfillstyle(LINE_FILL,BLUE);
pieslice(midx, midy, 0, 75, 100);
outtextxy(midx+100, midy - 75, "20.83%");

setfillstyle(XHATCH_FILL,RED);
pieslice(midx, midy, 75, 225, 100);
outtextxy(midx-175, midy - 75, "41.67%");

setfillstyle(WIDE_DOT_FILL,GREEN);
pieslice(midx, midy, 225, 360, 100);
outtextxy(midx+75, midy + 75, "37.50%");

getch();
return 0;
}


Related Topic 8 Queens Problem Backtracking Algorithm and Java Program
8 Queens Problem with Recursive Function in CPP
Network Security Management for Large Government, School, Businesses and Homes
How to Install Anti-virus ClamAV
How to Protect the Linux Machine against Dangerous Malware rootkits

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback