#include "stdio.h"
#include "conio.h"
#include "graphics.h"
#include "stdlib.h"
#define P 10
typedef struct coordinate
{
int x,y;
}PT;
int margin=10;
int data[P],interval;
int mp[P],cb;
int labellength=24,dataoffset=18;
PT pt[P];
PT txtpos;
void FunDL();
void FunBC(int data[P]);
void main()
{
int gd=DETECT,gm,i,c,r,k=0;
clrscr();
printf("Enter Data Point Max 400");
r=3;
for(i=1;i<=P;i++)
{
start :
gotoxy(1,r);
printf("x[%d]",i);
scanf("%d",&data[i]);
if(k>data[i] || data[i]>400)
{
gotoxy(1,r);
printf(" ");
goto start;
}
k=data[i];
r+=2;
}
initgraph(&gd,&gm,"c:\\tc\\bgi");
outtextxy(260,10,"Cricket Chart");
line(30,20,30,450);
line(30,450,580,450);
outtextxy(5,400,"50");
outtextxy(5,350,"100");
outtextxy(5,300,"150");
outtextxy(5,250,"200");
outtextxy(5,200,"250");
outtextxy(5,150,"300");
outtextxy(5,100,"350");
outtextxy(5,50,"400");
outtextxy(80,455,"5");
outtextxy(130,455,"10");
outtextxy(180,455,"15");
outtextxy(230,455,"20");
outtextxy(280,455,"25");
outtextxy(330,455,"30");
outtextxy(380,455,"35");
outtextxy(430,455,"40");
outtextxy(480,455,"45");
outtextxy(530,455,"50");
cb=getmaxy()+38;
interval=(540-margin)/P;
FunBC(data);
getch();
closegraph();
}
void FunBC(int data[P])
{
int i,k=30;
for(i=1;i<=P;i++)
{
pt[i].y=cb-dataoffset-data[i]-49;
}
pt[0].y=450;
for(i=0;i<=P-1;i++)
{
line(k,pt[i].y,k+50,pt[i+1].y);
k+=50;
circle(k,pt[i+1].y,5);
}
}