//Program to implement the use of pieslice
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm,midx,midy;
float a,b,c,d,e,sum,a1,b1,c1,d1,e1;
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
midx=getmaxx()/2; midy=getmaxy()/2;
printf("Enter any 5 values");
scanf("%f%f%f%f%f",&a,&b,&c,&d,&e);
sum=a+b+c+d+e;
a1=(a/sum)*360;
b1=(b/sum)*360;
c1=(c/sum)*360;
d1=(d/sum)*360;
e1=(e/sum)*360;
printf("Values\tAngle\n");
printf("\n%.0f\t%.0f",a,a1);
printf("\n%.0f\t%.0f",b,b1);
printf("\n%.0f\t%.0f",c,c1);
printf("\n%.0f\t%.0f",d,d1);
printf("\n%.0f\t%.0f",e,e1);
setfillstyle(2,1);
pieslice(midx,midy,0,a1,100);
setfillstyle(2,2);
pieslice(midx,midy,a1,a1+b1,100);
setfillstyle(2,3);
pieslice(midx,midy,a1+b1,a1+b1+c1,100);
setfillstyle(2,4);
pieslice(midx,midy,a1+b1+c1,a1+b1+c1+d1,100);
setfillstyle(2,5);
pieslice(midx,midy,a1+b1+c1+d1,a1+b1+c1+d1+e1,100);
getch();
closegraph();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.