Simple Criss-Cross Game Game Project using C Language
December 31, 2019
This is a simple Criss-Cross Game Project developed using C-Language and Graphics. The IDE and environment used for this project Turbo C.
Screenshort
Code for Criss-Cross Game
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<process.h> #include<dos.h> #define ESC 0x1b #define ENT 13 #define TAB 9 #define LEFT 75 #define RIGHT 77 FILE *fs; struct winlist { char win[60]; char loss[60]; }; typedef struct winlist wk; long int SIZE =sizeof(wk); void Swindow(void); void HELP(void); void graf(void); int Clear(int ); int Refresh(int ); char sub_REFRESH(); void animation(void); void submain(void); void subshow(void); void result(void); void msgbox(void); int optionYN(void); void winbox(void); void winlist(void); void winbox1(void); int matrix[3][3]; int mat[3][3]; void main(void) { int i,j,a,gdriver = DETECT, gmode; char choice; initgraph(&gdriver, &gmode, "c:\\WINDOWS/Crossgam/"); // Change Driver Path as per your turbo C Graphics EGAVGA.BGI file animation(); exit(0); } void submain(void) { int flag=0,i,j,a; char choice; Swindow(); subshow(); input: fflush(stdin); choice=getch(); setfillstyle(SOLID_FILL,BLACK); bar(300,400,600,430); if(choice==ESC){ HELP(); goto input; } if(choice=='0'){msgbox();} if(choice=='s'||choice=='S'){winbox1();winlist();} if(choice=='7' && flag==0 && mat[1][1]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(240,160,"X"); flag=1; matrix[1][1]=1,mat[1][1]=1; if(matrix[1][1]==matrix[1][2] && matrix[1][2]==matrix[1][3]) { setcolor(CYAN); line(220,170,410,170); flag=Refresh(flag); } else if(matrix[1][1]==matrix[2][1] && matrix[2][1]==matrix[3][1]) { setcolor(CYAN); line(245,150,245,300); flag=Refresh(flag); } else if(matrix[1][1]==matrix[2][2] && matrix[2][2]==matrix[3][3]) { setcolor(CYAN); line(235,150,410,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='7' && flag==1&& mat[1][1]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(240,160,"O"); flag=0; matrix[1][1]=2,mat[1][1]=1; if(matrix[1][1]==matrix[1][2] && matrix[1][2]==matrix[1][3]) { setcolor(CYAN); line(220,170,410,170); flag=Refresh(flag); } else if(matrix[1][1]==matrix[2][1] && matrix[2][1]==matrix[3][1]) { setcolor(CYAN); line(245,150,245,300); flag=Refresh(flag); } else if(matrix[1][1]==matrix[2][2] && matrix[2][2]==matrix[3][3]) { setcolor(CYAN); line(235,150,410,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='8' && flag==0&& mat[1][2]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(305,160,"X"); flag=1; matrix[1][2]=1,mat[1][2]=1; if(matrix[1][1]==matrix[1][2] && matrix[1][2]==matrix[1][3]) { setcolor(CYAN); line(220,170,410,170); flag=Refresh(flag); } else if(matrix[1][2]==matrix[2][2] && matrix[2][2]==matrix[3][2]) { setcolor(CYAN); line(315,150,315,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='8' && flag==1&& mat[1][2]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(305,160,"O"); flag=0; matrix[1][2]=2,mat[1][2]=1; if(matrix[1][1]==matrix[1][2] && matrix[1][2]==matrix[1][3]) { setcolor(CYAN); line(220,170,410,170); flag=Refresh(flag); } else if(matrix[1][2]==matrix[2][2] && matrix[2][2]==matrix[3][2]) { setcolor(CYAN); line(315,150,315,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='9' && flag==0&& mat[1][3]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(370,160,"X"); flag=1; matrix[1][3]=1,mat[1][3]=1; if(matrix[1][1]==matrix[1][2] && matrix[1][2]==matrix[1][3]) { setcolor(CYAN); line(220,170,410,170); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][3] && matrix[2][3]==matrix[3][3]) { setcolor(CYAN); line(375,150,375,300); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][2] && matrix[2][2]==matrix[3][1]) { setcolor(CYAN); line(390,150,220,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='9' && flag==1&& mat[1][3]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(370,160,"O"); flag=0; matrix[1][3]=2,mat[1][3]=1; if(matrix[1][1]==matrix[1][2] && matrix[1][2]==matrix[1][3]) { setcolor(CYAN); line(220,170,410,170); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][3] && matrix[2][3]==matrix[3][3]) { setcolor(CYAN); line(375,150,375,300); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][2] && matrix[2][2]==matrix[3][1]) { setcolor(CYAN); line(390,150,220,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='4' && flag==0&& mat[2][1]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(240,215,"X"); flag=1; matrix[2][1]=1,mat[2][1]=1; if(matrix[1][1]==matrix[2][1] && matrix[2][1]==matrix[3][1]) { setcolor(CYAN); line(245,150,245,300);flag=Refresh(flag); } else if(matrix[2][1]==matrix[2][2] && matrix[2][2]==matrix[2][3]) { setcolor(CYAN); line(235,215,400,215); flag=Refresh(flag); } else result(); goto input; } else if(choice=='4' && flag==1&& mat[2][1]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(240,215,"O"); flag=0; matrix[2][1]=2,mat[2][1]=1; if(matrix[1][1]==matrix[2][1] && matrix[2][1]==matrix[3][1]) { setcolor(CYAN); line(245,150,245,300); flag=Refresh(flag); } else if(matrix[2][1]==matrix[2][2] && matrix[2][2]==matrix[2][3]) { setcolor(CYAN); line(235,215,400,215); flag=Refresh(flag); } else result(); goto input; } else if(choice=='5' && flag==0&& mat[2][2]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(305,215,"X"); flag=1; matrix[2][2]=1,mat[2][2]=1; if(matrix[1][2]==matrix[2][2] && matrix[2][2]==matrix[3][2]) { setcolor(CYAN); line(315,150,315,300); flag=Refresh(flag); } else if(matrix[2][1]==matrix[2][2] && matrix[2][2]==matrix[2][3]) { setcolor(CYAN); line(235,215,400,215); flag=Refresh(flag); } else if(matrix[1][1]==matrix[2][2] && matrix[2][2]==matrix[3][3]) { setcolor(CYAN); line(235,150,410,300); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][2] && matrix[2][2]==matrix[3][1]) { setcolor(CYAN); line(390,150,220,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='5' && flag==1&& mat[2][2]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(305,215,"O"); flag=0; matrix[2][2]=2,mat[2][2]=1; if(matrix[1][2]==matrix[2][2] && matrix[2][2]==matrix[3][2]) { setcolor(CYAN); line(315,150,315,300); flag=Refresh(flag); } else if(matrix[2][1]==matrix[2][2] && matrix[2][2]==matrix[2][3]) { setcolor(CYAN); line(235,215,400,215); flag=Refresh(flag); } else if(matrix[1][1]==matrix[2][2] && matrix[2][2]==matrix[3][3]) { setcolor(CYAN); line(235,150,410,300); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][2] && matrix[2][2]==matrix[3][1]) { setcolor(CYAN); line(390,150,220,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='6' && flag==0&& mat[2][3]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(370,215,"X"); flag=1; matrix[2][3]=1,mat[2][3]=1; if(matrix[1][3]==matrix[2][3] && matrix[2][3]==matrix[3][3]) { setcolor(CYAN); line(375,150,375,300); flag=Refresh(flag); } else if(matrix[2][1]==matrix[2][2] && matrix[2][2]==matrix[2][3]) { setcolor(CYAN); line(235,215,400,215); flag=Refresh(flag); } else result(); goto input; } else if(choice=='6' && flag==1&& mat[2][3]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(370,215,"O"); flag=0; matrix[2][3]=2,mat[2][3]=1; if(matrix[1][3]==matrix[2][3] && matrix[2][3]==matrix[3][3]) { setcolor(CYAN); line(375,150,375,300); flag=Refresh(flag); } else if(matrix[2][1]==matrix[2][2] && matrix[2][2]==matrix[2][3]) { setcolor(CYAN); line(235,215,400,215); flag=Refresh(flag); } else result(); goto input; } else if(choice=='1' && flag==0&& mat[3][1]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(240,270,"X"); flag=1; matrix[3][1]=1,mat[3][1]=1; if(matrix[1][1]==matrix[2][1] && matrix[2][1]==matrix[3][1]) { setcolor(CYAN); line(245,150,245,300); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][2] && matrix[2][2]==matrix[3][1]) { setcolor(CYAN); line(390,150,220,300); flag=Refresh(flag); } else if(matrix[3][1]==matrix[3][2] && matrix[3][2]==matrix[3][3]) { setcolor(CYAN); line(235,275,400,275); flag=Refresh(flag); } else result(); goto input; } else if(choice=='1' && flag==1&& mat[3][1]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(240,270,"O"); flag=0; matrix[3][1]=2,mat[3][1]=1; if(matrix[1][1]==matrix[2][1] && matrix[2][1]==matrix[3][1]) { setcolor(CYAN); line(245,150,245,300); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][2] && matrix[2][2]==matrix[3][1]) { setcolor(CYAN); line(390,150,220,300); flag=Refresh(flag); } else if(matrix[3][1]==matrix[3][2] && matrix[3][2]==matrix[3][3]) { setcolor(CYAN); line(235,275,400,275); flag=Refresh(flag); } else result(); goto input; } else if(choice=='2' && flag==0&& mat[3][2]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(305,270,"X"); flag=1; matrix[3][2]=1,mat[3][2]=1; if(matrix[3][1]==matrix[3][2] && matrix[3][2]==matrix[3][3]) { setcolor(CYAN); line(235,275,400,275); flag=Refresh(flag); } else if(matrix[1][2]==matrix[2][2] && matrix[2][2]==matrix[3][2]) { setcolor(CYAN); line(315,150,315,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='2' && flag==1&& mat[3][2]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(305,270,"O"); flag=0; matrix[3][2]=2,mat[3][2]=1; if(matrix[3][1]==matrix[3][2] && matrix[3][2]==matrix[3][3]) { setcolor(CYAN); line(235,275,400,275); flag=Refresh(flag); } else if(matrix[1][2]==matrix[2][2] && matrix[2][2]==matrix[3][2]) { setcolor(CYAN); line(315,150,315,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='3' && flag==0&& mat[3][3]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(370,270,"X"); flag=1; matrix[3][3]=1,mat[3][3]=1; if(matrix[3][1]==matrix[3][2] && matrix[3][2]==matrix[3][3]) { setcolor(CYAN); line(235,275,400,275); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][3] && matrix[2][3]==matrix[3][3]) { setcolor(CYAN); line(375,150,375,300); flag=Refresh(flag); } else if(matrix[1][1]==matrix[2][2] && matrix[2][2]==matrix[3][3]) { setcolor(CYAN); line(235,150,410,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='3' && flag==1&& mat[3][3]==0) { setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(370,270,"O"); flag=0; matrix[3][3]=2,mat[3][3]=1; if(matrix[3][1]==matrix[3][2] && matrix[3][2]==matrix[3][3]) { setcolor(CYAN); line(235,275,400,275); flag=Refresh(flag); } else if(matrix[1][3]==matrix[2][3] && matrix[2][3]==matrix[3][3]) { setcolor(CYAN); line(375,150,375,300); flag=Refresh(flag); } else if(matrix[1][1]==matrix[2][2] && matrix[2][2]==matrix[3][3]) { setcolor(CYAN); line(235,150,410,300); flag=Refresh(flag); } else result(); goto input; } else if(choice=='R'||choice=='r') { a=1; for(i=1;i<=3;i++){for(j=1;j<=3;j++){matrix[i][j]=a;a++;}} flag=0;Swindow(); for(i=1;i<=3;i++){for(j=1;j<=3;j++){mat[i][j]=0;}} graf(); flag=Clear(flag); goto input; } else { sound(2589); delay(150);nosound();setcolor(GREEN); settextstyle(DEFAULT_FONT,HORIZ_DIR,1);outtextxy(300,400,"Invalid key press"); goto input; } stop : closegraph(); _exit(0); } void Swindow(void) { cleardevice(); setcolor(RED); settextstyle(DEFAULT_FONT,HORIZ_DIR,3); outtextxy(30,50,"CROSS PUZZLE MIXING GAME"); setcolor(WHITE); line(225,190,400,190); line(225,250,400,250); line(275,150,275,300); line(350,150,350,300); setcolor(YELLOW); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(25,450,"press `Esc' to Help. press `0'(zero) to exit. press `R' to restart."); outtextxy(25,470,"Press `S' To Show the Winer List"); setcolor(GREEN); outtextxy(50,400,"ENTER VALUE :"); } int Refresh(int flag) { int i,j,a=5; for(i=1;i<=3;i++){for(j=1;j<=3;j++){matrix[i][j]=a;a++;}} while(!kbhit()) { if(flag==0) { sound(200); gotoxy(50,24); printf("SECOND PLAYER IS WINER"); delay(1000);nosound(); } else { sound(200); gotoxy(50,24); printf("FIRST PLAYER IS WINER"); delay(1000);nosound(); } gotoxy(50,24); printf(" "); delay(500); } winbox(); flag=0;sub_REFRESH(getch());graf();Swindow(); for(i=1;i<=3;i++){for(j=1;j<=3;j++){mat[i][j]=0;}} return flag; } int Clear(int flag) { int i,j,a=5; for(i=1;i<=3;i++){for(j=1;j<=3;j++){matrix[i][j]=a;a++;}} flag=0; Swindow(); return flag; } void HELP(void) { int i=50; cleardevice(); setfillstyle(SOLID_FILL,LIGHTGRAY); bar(0,0,getmaxx(),getmaxy()); setcolor(YELLOW); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(50,25,"THE INSTRUCTIONS TO PLAY THE GAME"); setcolor(MAGENTA); outtextxy(380,100,"X"); outtextxy(387,118,"O"); setcolor(BLUE); outtextxy(220,185,"7 8 9"); outtextxy(220,225,"4 5 6"); outtextxy(220,275,"1 2 3");settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setcolor(BLACK); outtextxy(50,90,"[*] Two players must need to play this game."); outtextxy(50,105,"[*] First player holds the simbol of ."); outtextxy(50,120,"[*] Second player holds the simbol of ."); outtextxy(50,320,"[*] Which player creats a straight line into the box, he is the winer."); outtextxy(50,335,"[*] To restart the game as fresh, press `R'."); outtextxy(50,350,"[*] press `0' (zero) to exit the game."); outtextxy(330,460,"press any key to return back into game"); line(250,170,250,300);line(320,170,320,300); line(200,210,375,210);line(200,260,375,260); setcolor(RED); outtextxy(150,150,"The Keywords which contains the value of puzzle box"); setcolor(LIGHTGREEN);settextstyle(DEFAULT_FONT,HORIZ_DIR,2); while(!kbhit()) { while(!kbhit()) { outtextxy(125,400,"Made By - Subroto Mondal"); sound(i);delay(500);bar(123,398,520,435); delay(500);i=i+15; } nosound(); } Swindow();subshow(); } void graf(void) { int X=160,i=0; cleardevice();setfillstyle(SOLID_FILL,BLUE); bar(150,220,465,235);setfillstyle(SOLID_FILL,LIGHTGREEN); bar(155,215,470,230);delay(500); while(i<24) { setfillstyle(INTERLEAVE_FILL,RED); bar(X,218,X+10,228);i++;X=X+13; delay(50); } setfillstyle(SOLID_FILL,DARKGRAY); bar(180,185,460,200); } char sub_REFRESH(char ch) { int i,j,flag,a=5; if (ch=='R'||ch=='r') { a=5; for(i=1;i<=3;i++){for(j=1;j<=3;j++){matrix[i][j]=a;a++;}} flag=0; Swindow(); for(i=1;i<=3;i++){for(j=1;j<=3;j++){mat[i][j]=0;}} flag=Clear(flag); } else if(ch=='0') { a=5; for(i=1;i<=3;i++){for(j=1;j<=3;j++){matrix[i][j]=a;a++;}} for(i=1;i<=3;i++){for(j=1;j<=3;j++){mat[i][j]=0;}} msgbox(); } else { sound(2589);delay(150); nosound(); setcolor(GREEN); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(300,400,"Invalid key press"); } return 0; } void animation(void) { int x=120,y=55,i,x1=500,y1=55,x2=320,y2=40,x3=130,y3=230; setfillstyle(SOLID_FILL,WHITE);bar(0,0,getmaxx(),getmaxy()); delay(1000); while(!kbhit()) { setcolor(BLACK);circle(x,y,50);circle(x1,y1,50); x=x+1,y=y+1,x1=x1-1,y1=y1+1; delay(9); if(y==430) { setcolor(LIGHTBLUE);settextstyle(TRIPLEX_FONT,HORIZ_DIR,3); for(i=1;i<=3;i++) { bar(90,235,700,265);delay(200); outtextxy(90,235,"Wel Come To Cross Pazzel Mixing Game"); delay(1000); } delay(500);bar(0,0,getmaxx(),getmaxy()); setcolor(RED); while(!kbhit()) { circle(x2,y2,50);circle(x3,y3,50); y2=y2+2,x3=x3+2;delay(20); if(y2==430) { setcolor(BLACK);settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(385,6,"Compiled With :Terbo C++"); outtextxy(385,20,"Graphics :Borland Graphics C++"); delay(1000); goto point; } } } } point: submain(); } void subshow(void) { if(matrix[1][1]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(240,160,"X");} if(matrix[1][1]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(240,160,"O");} if(matrix[1][2]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(305,160,"X");} if(matrix[1][2]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(305,160,"O");} if(matrix[1][3]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(370,160,"X");} if(matrix[1][3]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(370,160,"O");} if(matrix[2][1]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(240,215,"X");} if(matrix[2][1]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(240,215,"O");} if(matrix[2][2]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(305,215,"X");} if(matrix[2][2]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(305,215,"O");} if(matrix[2][3]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(370,215,"X");} if(matrix[2][3]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(370,215,"O");} if(matrix[3][1]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(240,270,"X");} if(matrix[3][1]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(240,270,"O");} if(matrix[3][2]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(305,270,"X");} if(matrix[3][2]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(305,270,"O");} if(matrix[3][3]==1){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(370,270,"X");} if(matrix[3][3]==2){setcolor(MAGENTA); settextstyle(DEFAULT_FONT,HORIZ_DIR,2);outtextxy(370,270,"O");} } void result (void) { int a,i,j,flag; if(mat[1][1]==1&&mat[1][2]==1&&mat[1][3]==1&&mat[2][1]==1&&mat[2][2]==1&&mat[2][3]==1&&mat[3][1]==1&&mat[3][2]==1&&mat[3][3]==1) { sound(2589); delay(150);nosound();setcolor(GREEN); while(!kbhit()) { settextstyle(DEFAULT_FONT,HORIZ_DIR,1);outtextxy(250,400,"Incomplite game press any key to reset the game"); delay(500); bar(240,390,900,410); delay(100); } graf(); a=5; for(i=1;i<=3;i++){for(j=1;j<=3;j++){matrix[i][j]=a;a++;}} flag=0;for(i=1;i<=3;i++){for(j=1;j<=3;j++){mat[i][j]=0;}} flag=Clear(flag);submain(); } } void msgbox(void) { int CHOICE,i,j,a,flag; setfillstyle(INTERLEAVE_FILL,BROWN);bar(130,200,495,350); setfillstyle(SOLID_FILL,DARKGRAY); bar(140,210,485,340); setfillstyle(SOLID_FILL,LIGHTCYAN);bar(142,212,483,223); setcolor(BLACK); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(433,214,"_ [] X");outtextxy(145,214,"Meassage Box"); setcolor(WHITE);outtextxy(180,250,"Are You Want To Sure Quit Game?"); outtextxy(210,310,"Press TAB To Select Option."); outtextxy(210,325,"Press Enter To Select Choice.");CHOICE=optionYN(); if(CHOICE==1){closegraph();exit(0);}else{submain();} } int optionYN(void) { int CHOICE,ch; input: CHOICE=0; settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setfillstyle(SOLID_FILL,DARKGRAY);bar(320,280,370,300); setfillstyle(SOLID_FILL,BLACK); bar(395,280,445,300); setfillstyle(SOLID_FILL,WHITE); bar(325,275,375,295); bar(400,275,450,295);setcolor(GREEN); outtextxy(340,282,"YES");settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(410,278,"NO"); fflush(stdin); ch=getch(); if(ch==TAB||ch==LEFT) { settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setfillstyle(SOLID_FILL,BLACK);bar(320,280,370,300); setfillstyle(SOLID_FILL,DARKGRAY);bar(395,280,445,300); setfillstyle(SOLID_FILL,WHITE);bar(325,275,375,295); bar(400,275,450,295);setcolor(GREEN); outtextxy(420,282,"NO");settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(328,278,"YES");CHOICE=1; if(getch()==ENT){return CHOICE;}else{goto input;} } if(ch==ENT){return CHOICE; }else{ goto input; } } void winbox(void) { wk w; char ch; int CHOICE,i,j,a,flag; setfillstyle(INTERLEAVE_FILL,BROWN);bar(130,200,495,350); setfillstyle(SOLID_FILL,DARKGRAY); bar(140,210,485,340); setfillstyle(SOLID_FILL,LIGHTCYAN);bar(142,212,483,223); setcolor(BLACK); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(433,214,"_ [] X");outtextxy(145,214,"Meassage Box"); setcolor(WHITE);outtextxy(160,250,"ENTER WINER NAME :-"); outtextxy(160,280,"ENTER LOOSER NAME :-"); outtextxy(210,325,"Press Enter To Save This Record."); setcolor(WHITE); outtextxy(140,230," Press 'Y'to enter winer and losser name.."); getch(); ch=getch(); if(ch=='y'||ch=='Y') { gotoxy(41,16); fflush(stdin); gets(w.win); gotoxy(41,18); fflush(stdin); gets(w.loss); fs=fopen("c:\\WINDOWS/CROSSGAM/DATA.DAT","ab"); fwrite(&w,SIZE,1,fs); fclose(fs); } else { setfillstyle(SOLID_FILL,DARKGRAY); bar(200,320,485,340); outtextxy(210,325,"The record is not save.."); } } void winlist(void) { int x=24,y=11,x1=45,x2=40,c=1,count=0,count1=0,ch; wk w; winbox1(); fs=fopen("c:\\WINDOWS/CROSSGAM/DATA.DAT","r"); if(fs==NULL) { outtextxy(225,230,"NO DATA FILE WAS FOUND"); } else { while (fread(&w,SIZE,1,fs)==1) { count++; if(count==0) outtextxy(225,230,"NO RECORD WAS FOUND"); } fclose(fs); fs=fopen("c:\\WINDOWS/CROSSGAM/DATA.DAT","r"); while(fread(&w,SIZE,1,fs)==1) { gotoxy(x-5,y);printf("%d.)",c); gotoxy(x,y);puts(w.win); gotoxy(x2,y);printf("Vs"); gotoxy(x1,y);puts(w.loss); y=y+1; c++; count1++; if(count1==10) { gotoxy(19,23); printf("Press enter key to continue & `E' to exit "); ch=getch();if(ch=='e'||ch=='E'){ break;} count1=0; y=11; count1=0; winbox1(); } } }setcolor(WHITE);outtextxy(210,325,"Press any key to back."); setcolor(WHITE); getch(); submain(); Swindow(); subshow(); } void winbox1(void) { setfillstyle(INTERLEAVE_FILL,BROWN);bar(130,100,495,380); setfillstyle(SOLID_FILL,DARKGRAY); bar(140,110,485,370); setfillstyle(SOLID_FILL,LIGHTCYAN);bar(142,112,483,123); setcolor(BLACK); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(433,114,"_ [] X");outtextxy(145,114,"WINER LIST BOX"); setcolor(WHITE);outtextxy(160,130,"WINER NAME"); outtextxy(380,130,"LOOSER NAME ");setcolor(BLACK); line(150,147,477,147);setcolor(RED); }
Download Entire Project and Setup File Here
Click Here to download Criss-Cross Game
The following two tabs change content below.
Subroto Mondal
Chief Coordinator HR&CR
I like Programming and New Technologies. And work with Linux.
Latest posts by Subroto Mondal (see all)
- Installing and Configuring OpenShift: A Step-by-Step Guide for Linux Experts with Terminal Code - February 19, 2023
- Sed Command in Linux with Practical Examples - February 19, 2023
- Rsync Command uses with examples - February 19, 2023