All pastes #909283 Raw Edit

Unnamed

public c v1 · immutable
·published 2008-02-19 00:44 UTC
rendered paste body
/* * G-Unot * TIC_TAC_TOE.c * Purpose: To Let a User play tic tac toe * * 0 1 2 * 3 4 5 * 6 7 8 */#include <stdio.h>int main(){	int win = 0;	int turns_left = 0;	int square = 0; // square to be chosen	char user1 = 1; // User 1 	char user2 = -1; // User 2	char board[9] = {0}; // Our tic tac toe board	while(turns_left >= 0){		printf("User1: Please Select a square to be filled (i.e 1-9)\n");		scanf("%d",&square);				if(square > 0 && square <= 8)		{			if(board[square] != 0)			{				printf("Square already used, please use another one\n");				break;			}			else {				board[square] = user1;				for (x = 0; x < 9; x += 3) {					win = board[x] + board[x + 1] + board[x + 2];				}																										} 	return 0;}