#include<graphics.h>
#include<stdio.h>
#include<math.h>
#include<dos.h>
#include<conio.h>
void main()
{
int i,n,a,b;
void drawrect(int ,int);
int graphdriver = DETECT, graphmode;
initgraph(&graphdriver, &graphmode, "..\\bgi");
setcolor(CYAN);
printf("ENTER THE NUMBER OF DATA ELEMENTS\n");
scanf("%d",&n);
line(1,1,1,479);// Y axis
line(1,479,640,479);// X axis
for(i=1;i<=25;i++)
{
outtextxy(40*i,470,"|");
outtextxy(1,479-40*i,"-");
}
printf("ENTER X AND Y CO-ORDINATES \n");
for(i=1;i<=n;i++)
{
scanf("%d %d",&a,&b);
b--;
drawrect(a*40,b*40);
}
getch();
closegraph();
}
void drawrect(int a,int b)
{
setfillstyle(SOLID_FILL,CYAN);
bar3d(a,478,a,430-b,5,1);
}
Not Satisfied ? Just search & get the result
Related posts:
- C Program – Display a line graph using midpoint line algorithm.
- C program – Spiral Model
- Sample – Program to construct a 3-dimensional bar.
- C Program – Create a house and perform the operations.
- C Program – Draw a rectangle and perform the operations.
Tagged as:
Bar Graph,
Bar Graph using c program,
C program to implement Bar Graph
Me, freelance system administrator having the qualification of Diploma in Electronics & Tele-communication + MCSE + CCNA + CST + 5 years of experience in IT field.
If you like This post, you can follow TheOnlineTutorials on Twitter.
Contact me Via email: support@theonlinetutorials.com
Subscribe to feed via Feed or EMAIL to receive instant updates.
Legal Disclaimer:All information found on the site is without any implied warranty of fitness for any purpose or use whatsoever. Content author/site administrator is not responsible for any loss occurred due to mistakes in this tutorial. Use this tutorial website at your own risk.