Coding Solution
Coding Solution of Tic Tac Toe Game in C ~By Shreya Chakravarty Rules of the game of Tic-Tac-Toe:- The game is to be played between two people. One of the player chooses ‘O’ and the other ‘X’ to mark their respective cells. The game starts with one of the players and the game ends when one of the players has one whole row/ column/ diagonal filled with his/her respective character (‘O’ or ‘X’). If no one wins, then the game is said to be draw. Solution:- The code for the game is:- #include <stdio.h> #include <conio.h> char square[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; int checkwin() { if (square[1] == square[2] && square[2] == square[3]) return 1; else if (square[4] == square[5] && square[5] == square[6]) return 1; else if (square[7] == square[8] && square[8] == square[9]) return 1...
Comments
Post a Comment