#include #include #include // Tic-Tac-Toe // // Write a complete C program which inspects the final configuration // of a Tic-Tac-Toe board and announces the winner or declares a tie. // The program must also print the location of the winning triple // (e.g., row 1-3, column 1-3, main diagonal, or minor diagonal). // The board is stored in a 2D char array of the form: // char board[3][3] ={{'x', 'o', 'x'}, // {'x', 'o', 'o'}, // {'x', 'x', 'o'}}; // // Sample output: Player x wins. See column 1. #define N 10 int main() { char c[3][3] = {{'o', 'x', 'o'}, {'x', 'o', 'o'}, {'x', 'x', 'o'}}; if((c[0][0] == c[0][1]) && (c[0][0] == c[0][2])) printf("Player %c wins (row 1)\n", c[0][0]); else if((c[0][0] == c[1][1]) && (c[0][0] == c[2][2])) printf("Player %c wins (diagonal 1)\n", c[0][0]); else printf("Keep checking\n"); // You can finish this on your own. system("pause"); }