TICTACTOE3.c - = = | | | This C Program was created by...

This preview shows page 1 - 4 out of 6 pages.

/* ================================================================================ ======= | | | .;''-. - This C Program was created by: Maria Isaura Lopez | | .' | `._ - CS1410 PROGRAMMING I Fall 2014 | | /` ; `'. | | .' \ \ - This program will two players play TIC- TAC-TOE | | ,'\| `| | - using a globa array to represent the board | | | -'_ \ `'.__,J - and global variables for the players. | | ;' `. `'.__.' PROGRAM 5 | | | `"-.___ ,' | | '-, / | | |.-`-.______-| | | } __.--'L | | ; _,- _.-"`\ ___ | | `7-;" ' _,,--._ ,-'`__ `. | | |/ ,'- .7'.-"--.7 | _.-' | | ; ,' .' .' .-. \/ .' | | ; / / .'.- ` |__ .' | | \ | .' / | \_)- `'/ _.-'`` | | _,.--../ .' \_) '`_ \'` | | '`f-'``'.`\;;' ''` '-` | | | \`.__. ;;;, ) / | | `-._,|;;;,, /\ ,' | | / /<_;;;;' `-._ _,-' | | | '- /;;;;;, `t'` \. I like nonsence. | | `'-'`_.|,';;;, '._/| It wakes up the brain cells! | | ,_.-' \ |;;;;; `-._/ | | / `;\ |;;;, `" - Theodor Seuss Geisel - | | .' `'`\;;, / | | ' ;;;'| | | .--. ;.:`\ _.--, |
| | `'./;' _ '_.' | | | \_ `"7f `) / | | |` _.-'`t-'`"-.,__.' | | `'-'`/;; | | \ mx | | ;;; ,' | ` | | / ' | ================================================================================ ======== */ #include <stdio.h> /* standard library for input - output*/ char TTT [3][3] = {' '}; /* initialize Array to hold game pieces */ int player=0; /* initialize player turn */ int winner=0; /* do we have a winner? */ void title (void) /* Function that prints the headers or Title and Instructions */ { printf(" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + \n"); printf(". .\n"); printf(". This Program will let two players play .\n"); printf(". TIC-TAC-TOE and will verify for a .\n"); printf(". Winner move or a Draw . .\n"); printf(". .\n"); printf(" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + \n"); printf("\n\n"); } void separator (void) /* Matrix to select choice */ { printf(" 1 | 2 | 3 \n"); printf(" Here is your ---+---+---\n"); printf(" Matrix to select 4 | 5 | 6 \n"); printf(" your position ---+---+---\n"); printf(" 7 | 8 | 9
\n\n"); } void board (void) /* prints board with contents */ { printf("\n\n"); printf("\t %c | %c | %c \n", TTT[0][0], TTT[0][1], TTT[0][2]); /* allocate spaces */ printf("\t----+---+----\n"); printf("\t

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture