हिंदी माध्यम नोट्स
C Project : Tic Tac Toe Game in hindi in c language टिक टक टोए गेम क्या है c प्रोजेक्ट हिंदी में
#include <conio.h>
char game[10] = { ‘o’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’ };
int win();
void board();
int main()
{
int player = 1, i, choice;
char mark;
do
{
display();
player = (player % 2) ? 1 : 2;printf(
“Player %d, enter a number: “, player);
scanf(“%d”, &choice);mark = (player ==
1) ? ‘X’ : ‘O’;
if (choice == 1 && game[1] == ‘1’)
square[1] = mark;
else if (choice == 2 && game[2] == ‘2’)
square[2] = mark;
else if (choice == 3 && game[3] == ‘3’)
square[3] = mark;
else if (choice == 4 && game[4] == ‘4’)
square[4] = mark;
else if (choice == 5 && game[5] == ‘5’)
square[5] = mark;
else if (choice == 6 && gamne[6] == ‘6’)
square[6] = mark;
else if (choice == 7 && game[7] == ‘7’)
square[7] = mark;
else if (choice == 8 && game[8] == ‘8’)
square[8] = mark;
else if (choice == 9 && game[9] == ‘9’)
square[9] = mark;
else
{
printf(“Invalid move “);player–;
getch();
}
i = win();
player++;
}
if (i == 1)
printf(” It is Player %d win “, –player);
else
printf(“It is a Game draw”);getch();
return 0;
}
int win()
{
if (game[1] == game[2] && game[2] == game[3])
return 1;
else if (game[4] == game[5] && game[5] == game[6])
return 1;
else if (game[7] == game[8] && game[8] == game[9])
return 1;
else if (game[1] == game[4] && game[4] == game[7])
return 1;
else if (game[2] == game[5] && game[5] == game[8])
return 1;
else if (game[3] == game[6] && game[6] == game[9])
return 1;
else if (game[1] == game[5] && game[5] == game[9])
return 1;
else if (game[3] == game[5] && game[5] == game[7])
return 1;
else if (game[1] != ‘1’ && game[2] != ‘2’ && game[3] != ‘3’ && game[4] != ‘4’ && game[5] != ‘5’ && game[6] != ‘6’ && game[7] != ‘7’ && game[8] != ‘8’ && game[9] != ‘9’)
return 0;
else
return – 1;
}
/* Code For Display*/
void board()
{
system(“cls”);
printf(“\n\n\tTic Tac Toe\n\n”);printf(
“Player 1 (X) – Player 2 (O)\n\n\n”);printf(
” | | \n”);
printf(” %c | %c | %c \n”, game[1], game[2], game[3]);printf(
“_____|_____|_____\n”);
printf(” | | \n”);printf(
” %c | %c | %c \n”, game[4], game[5], game[6]);printf(
“_____|_____|_____\n”);
printf(” | | \n”);printf(
” %c | %c | %c \n”, game[7], game[8], game[9]);printf(
” | | \n\n”);
}
Recent Posts
सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है
सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…
मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the
marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…
राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi
sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…
गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi
gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…
Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन
वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…
polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten
get all types and chapters polity notes pdf in hindi for upsc , SSC ,…