//BAR CHART STEP BY STEP
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
int x;
int a,b,c,d,e,f,g,h,i;
line(10,400,625,400);
line(50,10,50,450);
circle(50,400,5);
for(x=0;x<350;x=x+40)
{
line(47,360-x,53,360-x);
}
for(x=0;x<550;x=x+30)
{
line(80+x,397,80+x,403);
}
getch();
setfillstyle(2,1);
cout<<"Enter 1st value : ";cin>>a;
bar(80,400,110,400-4*a);
getch();
setfillstyle(2,2);
cout<<"Enter 2nd value : ";cin>>b;
bar(140,400,170,400-4*b);
getch();
setfillstyle(2,3);
cout<<"Enter 3rd value : ";cin>>c;
bar(200,400,230,400-4*c);
getch();
setfillstyle(2,4);
cout<<"Enter 4th value : ";cin>>d;
bar(260,400,290,400-4*d);
getch();
setfillstyle(2,5);
cout<<"Enter 5th value : ";cin>>e;
bar(320,400,350,400-4*e);
getch();
setfillstyle(2,6);
cout<<"Enter 6th value : ";cin>>f;
bar(380,400,410,400-4*f);
getch();
setfillstyle(2,7);
cout<<"Enter 7th value : ";cin>>g;
bar(440,400,470,400-4*g);
getch();
setfillstyle(2,10);
cout<<"Enter 8th value : ";cin>>h;
bar(500,400,530,400-4*h);
getch();
setfillstyle(2,9);
cout<<"Enter 9th value : ";cin>>i;
bar(560,400,590,400-4*i);
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.