C Program to Draw Pie Chart
#include<stdio.h> #include<conio.h> #include<graphics.h> main() { int gd, gm, x, y; gd=DETECT; initgraph(&gd, &gm, "C:\\TC\\BGI"); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); setcolor(WHITE); outtextxy(275,10,"Pie CHART"); x = getmaxx()/2; y = getmaxy()/2; setfillstyle(LINE_FILL,CYAN); pieslice(x, y, 0, 75, 100); outtextxy(x+100, y - 75, "25"); setfillstyle(HATCH_FILL,GREEN); pieslice(x, y, 75, 225, 100); outtextxy(x-175, y - 75, "40"); setfillstyle(INTERLEAVE_FILL,WHITE); pieslice(x, y, 225, 360, 100); outtextxy(x+75, y + 75, "35"); getch(); return 0; }
Output: