Bar Graph: Using C/C++ and Graphics

Hey guys, today I am going to post simple illustration of bar graph. May be next post I will post how to simulate bar graph with user input.
Here is the screen shot of the out put.
Bar Graph using C/C++ and Graphics
Here is the code, enjoy coding...

/*
    Progammer : Ashok Kumar Shrestha (ak007)
    Program details: Bar Graph
*/

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

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

   initgraph(&gd,&gm, "..\\bgi");

   setfillstyle(1,1);
   bar(0,10,639,450);

   setcolor(11);
   rectangle(0,10,639,450);

   line(200,35,450,35);
   settextstyle(2,0,7);

   setcolor(15);
   outtextxy(275,10,"Bar Graph");

   line(100,420,100,60);
   line(100,420,600,420);

   setlinestyle(2,0,7);
   outtextxy(95,35,"Y");
   outtextxy(610,405,"X");
   outtextxy(85,415,"0");

   setfillstyle(2,1);
   bar(150,100,200,419);

   setfillstyle(3,4);
   bar(225,150,275,419);

   setfillstyle(4,2);
   bar(300,200,350,419);

   setfillstyle(5,5);
   bar(375,125,425,419);

   setfillstyle(6,6);
   bar(450,175,500,419);

   getch();
   cleardevice();
   return 0;
}
//End of the program

Comments

Popular posts from this blog

Wizard Quiz: Privacy Policy

Sorting Hat: Privacy Policy

mTranslator