Chess Board using Computer Graphics in C Language

in #chess3 years ago (edited)

chess board.jpg

Program in C Language to design Chess Board

#include<graphics.h>
#include<conio.h>
void main()
{
int gd=DETECT,gm,midx,midy,i,j;
initgraph(&gd,&gm,"C:\TurboC3\BGI");
midx=getmaxx()/2;midy=getmaxy()/2;
outtextxy(midx-40,midy-220,"CHESS BOARD");
rectangle(midx-202,midy-202,midx+202,midy+202);
bar(midx-200,midy-200,midx+200,midy+200);
setfillstyle(HATCH_FILL,RED);
for(i=0;i<=300;i=i+100)
{
for(j=0;j<=300;j=j+100)
{
bar(midx-200+i,midy-200+j,midx-150+i,midy-150+j);
bar(midx-150+i,midy-150+j,midx-100+i,midy-100+j);
}
}
outtextxy(midx-40,midy+220,"Sukhvir Singh");
getch();
closegraph();
}