Oct 30, 2011

Play Tic Tac Toe or Cat

Three in a row in text mode, written in Turbo C. You can play against the computer.

/ *

COLLEGE OF ALAJUELA UNIVERSAITARIO

PROJECT C language program

COURSE: PROGRAMMING II

TEACHER: TEACHER: Chaco GEOVANNY RODRIGUEZ

STUDENT: FREDDY LEAN SALAZAR

MEAT: 20020188

III SEMESTER

A ¥ W 2002

* /



# Include <stdio.h>

# Include <conio.h>

# Include <dos.h>

Stdlib.h

/*------------------------------------------------ ------------------------------*/

/ / Here are saved and loaded the data to files

struct structure

{

int mat [3] [3] / / this is the matrix where it plays

NJ1 char [15] / / this saves the name of jugador1

NJ2 char [15] / / this saves the name of Player2

int jug / / this saves who is now the turn

int mod / / game mode "human vrs human" or "human machine vrs"

narch char [10] / / this is the name given to the game guard ¢

};



/ / Structure to assign the files available for game saves

struct files

{

FILE * save1;

FILE * save2;

FILE * save3;

FILE * save4;

FILE * save5;

FILE * save6;

FILE * save7;

FILE * save8;

FILE * save9;

};

/*------------------------------------------------ ------------------------------*/

limpiarMatrix void (int [] [3]);

void square (nomb1 char [], char nomb2 [], int mode);

imprimirSimbolo void (int, int, int);

void move (int [] [3], int, int, int, int * mode, char [], char [], structure, registry, file);

int number (int [] [3], int, int);

int winner (int [] [3]);

int draw (int [] [3]);

modoJuego int (void);

mejorJugada void (int [] [3], int * row, int * column);

void name (int mode, char nomb1 [], char nomb2 []);

ininombres void (char nomb1 [], char nomb2 []);

void limpiarregistro (data structure);

void archive (data1 structure, files, file);

unarchive void (* data2 structure, files, file, int * error);

matrizVacia int (int [] [3]);

imprimirGuardados void files (file);

presentation void (void);

void help (void);

void frame (void);

/*------------------------------------------------ ------------------------------*/

void main ()

{

record structure / / declaration of structure type record

file files / / file type declaration files

presentation () / / show presentation

int array [3] [3] / / matrix that is played

int out; / / variable that determines when to exit the program

int symbol / / variable that determines the symbol

int row, column / / positions in the matrix

int player;

int mode / / variable to store the game mode

char name1 [15] / / name of player 1

char name2 [15] / / name of player 2

randomize () / / generation of random numbers table

do / / loop that displays the main menu

{

textcolor (YELLOW);

textbackground (BLACK);

/ / Sets the symbol and player 1 in the middle of the game box

row = 1;

column = 1;

symbol = player = 1;

out = 0;

mode = modoJuego () / / determine how to play

if (mode == 3) / / if the option chosen is out

{

ClrScr ();

frame ();

gotoxy (25.12);

printf ("Suggestions: fleons79@hotmail.com");

delay (5000);

exit (1);

}

/ / Assign the names of the 2 players

names (so, name1, name2);

out = 2;

while ((salir! = 1)) / / while not wishing to leave the main £ men

{

limpiarMatrix (array) / / sets the entire array to zero

ClrScr ();

frame () / / prints the outer frame

box (name1, name2, mode) / / prints the playing area

imprimirSimbolo (symbol, row, column) / / prints a symbol on the screen

move (parent, player, row, column, & mode, name1, name2, record, file);

textcolor (YELLOW);

gotoxy (29.21);

printf ("Enter the OPTION");

textcolor (WHITE);

gotoxy (29.22);

printf ("1. EXIT THE MENU");

textcolor (WHITE);

gotoxy (29.23);

printf ("2. Restart Game");

gotoxy (47.21);

scanf ("% d", & out);

}

out = 0;

} While (salir! = 1);

}

/*------------------------------------------------ ------------------------------*/

/ / This procedure puts the entire array to zero, to est, empty

/ / Parameters:

/ / Mat [] [3] is the matrix where it plays

limpiarMatrix void (int mat [] [3])

{

for (int f = 0, f <3, f + +)

for (int c = 0, c <3, c + +)

{

sea ​​[f] [c] = 0;

imprimirSimbolo (0, f, c);

}

}

/*------------------------------------------------ ------------------------------*/

/ / This procedure prints the entire area of ​​the game

/ / Parameters:

/ / Nomb1 [] is the name of player 1

/ / Nomb2 [] is the name of player 2

/ / So the gameplay

void square (nomb1 char [], char nomb2 [], int mode)

{

int x, y, / / ​​to management positions on the screen

textbackground (BLACK);

textcolor (LIGHTCYAN);

gotoxy (13.6);

printf ("Player 1");

gotoxy (13.7);

printf ("% s", nomb1);

gotoxy (13.9);

printf ("TYPE");

gotoxy (13.10);

printf ("human");

gotoxy (13,12);

printf ("SYMBOL");

gotoxy (13.13);

x = 13;

y = 13;

textcolor (LIGHTCYAN);

gotoxy (x, y);

printf ("SSU USS");

gotoxy (x, y +1);

printf ("u");

gotoxy (x, y +2);

printf ("USS SSU");



textcolor (LIGHTRED);

gotoxy (57.6);

printf ("Player 2");

gotoxy (57.7);

printf ("% s", nomb2);

gotoxy (57.9);

printf ("TYPE");

gotoxy (57.10);

if (mode == 1)

printf ("human");

else

printf ("MACHINE");

gotoxy (57.12);

printf ("SYMBOL");

x = 57;

textcolor (LIGHTRED);

gotoxy (x, y);

printf ("ÜßßßÜ");

gotoxy (x, y +1);

printf ("Û Û");

gotoxy (x, y +2);

printf ("ßÜÜÜß");



textcolor (WHITE);

gotoxy (27.6);

printf ("ÉÍÍÍÍÍÍÍËÍÍÍÍÍÍÍËÍÍÍÍÍÍÍ" ");

gotoxy (27.7);

printf ("º");

gotoxy (35.7);

printf ("º");

gotoxy (43.7);

printf ("º");

gotoxy (51.7);

printf ("º");

gotoxy (27.8);

printf ("º");

gotoxy (35.8);

printf ("º");

gotoxy (43.8);

printf ("º");

gotoxy (51.8);

printf ("º");

gotoxy (27.9);

printf ("º");

gotoxy (35.9);

printf ("º");

gotoxy (43.9);

printf ("º");

gotoxy (51.9);

printf ("º");

gotoxy (27.10);

printf ("ÌÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍ ¹");

gotoxy (27.11);

printf ("º");

gotoxy (35.11);

printf ("º");

gotoxy (43.11);

printf ("º");

gotoxy (51.11);

printf ("º");

gotoxy (27.12);

printf ("º");

gotoxy (35.12);

printf ("º");

gotoxy (43.12);

printf ("º");

gotoxy (51.12);

printf ("º");

gotoxy (27.13);

printf ("º");

gotoxy (35.13);

printf ("º");

gotoxy (43.13);

printf ("º");

gotoxy (51.13);

printf ("º");

gotoxy (27.14);

printf ("ÌÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍ ¹");

gotoxy (27.15);

printf ("º");

gotoxy (35.15);

printf ("º");

gotoxy (43.15);

printf ("º");

gotoxy (51.15);

printf ("º");

gotoxy (27.16);

printf ("º");

gotoxy (35.16);

printf ("º");

gotoxy (43.16);

printf ("º");

gotoxy (51.16);

printf ("º");

gotoxy (27.17);

printf ("º");

gotoxy (35.17);

printf ("º");

gotoxy (43.17);

printf ("º");

gotoxy (51.17);

printf ("º");

gotoxy (27.18);

printf ("ÈÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍ ¼");

help ();

frame ();

}

/*------------------------------------------------ ------------------------------*/

/ / This procedimientose responsible for printing the symbol in the row and column.

/ / Parameters:

/ / Symbol is the variable that determines the current player's symbol

/ / Row is the variable that determines the current row

/ / Column is the variable that determines the current column

imprimirSimbolo void (int symbol, int row, int column)

{

int x, y;

/ / Row 0

if ((row == 0) & & (column == 0))

{

x = 29;

y = 7;

}

if (row == 0 & & column == 1)

{

x = 37;

y = 7;

}

if (row == 0 & & column == 2)

{

x = 45;

y = 7;

}

/ / ROW 1

if (row == 1 & & column == 0)

{

x = 29;

y = 11;

}

if (row == 1 & & column == 1)

{

x = 37;

y = 11;

}

if (row == 1 & & column == 2)

{

x = 45;

y = 11;

}

/ / ROW 2

if (row == 2 & & column == 0)

{

x = 29;

y = 15;

}

if (row == 2 & & column == 1)

{

x = 37;

y = 15;

}

if (row == 2 & & column == 2)

{

x = 45;

y = 15;

}

if (symbol ==- 1)

{

textcolor (LIGHTRED);

gotoxy (x, y);

printf ("ÜßßßÜ");

gotoxy (x, y +1);

printf ("Û Û");

gotoxy (x, y +2);

printf ("ßÜÜÜß");

}

if (symbol == 1)

{

textcolor (LIGHTCYAN);

gotoxy (x, y);

printf ("SSU USS");

gotoxy (x, y +1);

printf ("u");

gotoxy (x, y +2);

printf ("USS SSU");



}

if (symbol == 0) / / if it is empty

{

gotoxy (x, y);

printf ("");

gotoxy (x, y +1);

printf ("");

gotoxy (x, y +2);

printf ("");

}



/ / Print position indicators

textcolor (LIGHTGREEN);

textbackground (BLACK);

int x1, y1, x2, y2;

x1 = 26;

x2 = 53;

y1 = 5;

y2 = 19;

if ((row == 0) | | (row == 1) | | (row == 2))

{

gotoxy (27.5);

printf ("");

gotoxy (27.19);

printf ("");



gotoxy (x1, 8);

printf ("");

gotoxy (x2, 8);

printf ("");

gotoxy (x1, 12);

printf ("");

gotoxy (x2, 12);

printf ("");

gotoxy (x1, 16);

printf ("");

gotoxy (x2, 16);

printf ("");



gotoxy (x +2, y1);

printf ("% c", 31);

gotoxy (x +2, y2);

printf ("% c", 30);



gotoxy (x1, y +1);

printf ("% c", 16);

gotoxy (x2, y +1);

printf ("% c", 17);

}

textcolor (WHITE);

gotoxy (x +2, y +1);

}

/*------------------------------------------------ ------------------------------*/

/ / This procedure handles the recognition of typed keys,

/ / Parameters:

/ / Matrix [] [3] matrix that is played

/ / Variable that stores the player whose turn it is played

/ / Current row position in the matrix row

/ / Current column position column in the matrix

/ / Mode gameplay

/ / Jug1 [] name of player 1

/ / Jug2 [] name of player 2

/ / Register to store the data structure for storing and charging

/ / Archive files that are saved games

void move (int matrix [] [3], int player, int row, int column, int * mode, char jug1 [], char jug2 [], structure, registry, file)

{

int key, shift, space, ff, cc, error;

nombrea char [10];

turn = player;

do / / cycle to restart the game with the same players

{

if (turn == 1) / / if player 1's turn prints its symbol

{

gotoxy (27.4);

printf ("");

gotoxy (27.4);

textcolor (LIGHTCYAN);

printf ("IT IS TIME FOR% s", jug1);

frame ();

} Else if (turn ==- 1) / / if player 2's turn prints its symbol

{

gotoxy (27.4);

printf ("");

gotoxy (27.4);

textcolor (LIGHTRED);

printf ("IT IS TIME FOR% s", jug2);

frame ();

}

= getch ();// key reading of the key

if (key == 0)

key = getch ();

switch (key)

{

case 72: / / up directional

{

gotoxy (25.20);

printf ("");

imprimirSimbolo (matrix [row] [col], row, column) / / Print the contents of abandoned cell

/ / Change row

if (row == 0)

row = 2;

else

row -;

imprimirSimbolo (shift, row, column) / / Print the symbol of the symbol of the current player

break;

}

case 80: / / down directional

{

gotoxy (25.20);

printf ("");

imprimirSimbolo (matrix [row] [col], row, column) / / Print the contents of abandoned cell

/ / Change row

if (row == 2)

row = 0;

else

row + +;

imprimirSimbolo (shift, row, column) / / Print the symbol of the symbol of the current player

break;

}

case 75: / / left turn

{

gotoxy (25.20);

printf ("");

imprimirSimbolo (matrix [row] [col], row, column) / / Print the contents of abandoned cell

/ / Change column

if (column == 0)

column = 2;

else

column -;

imprimirSimbolo (shift, row, column) / / Print the symbol of the symbol of the current player

break;

}

case 77: / / right directional

{

gotoxy (25.20);

printf ("");

imprimirSimbolo (matrix [row] [col], row, column) / / Print the contents of abandoned cell

/ / Change column

if (column == 2)

column = 0;

else

column + +;

imprimirSimbolo (shift, row, column) / / Print the symbol of the symbol of the current player

break;

}

case 13: / / enter key

{

gotoxy (25.20);

printf ("");

if (matrix [row] [col] == 0) / / if the current position est empty

{

if (turn == 1) / / if player 1's turn

{

matrix [row] [col] = 1 / / assign this position to player 1

imprimirSimbolo (1, row, column) / / print your sign display ne

/ / If so is human machine vrs m making the move of the machine

if ((* mode == 2) & & (winner (matrix)! = 1) & & (tie (matrix)! = 1))

{

gotoxy (27.4);

printf ("");

gotoxy (27.4);

textcolor (LIGHTRED);

printf ("IT IS TIME FOR% s", jug2);

frame ();

mejorJugada (matrix, & row, & column) / / determine the best position to play

matrix [row] [col] =- 1 / / assign this position to Player 2

imprimirSimbolo (-1, row, column);

}

else / / if the mode is human vrs human change shifts

shift =- 1 / / shift change player 2

}

else

if (shift ==- 1) / / if player 2's turn

{

if (* mode == 1) / / if the mode is human vrs human

{

matrix [row] [col] =- 1 / / assign this position to Player 2

imprimirSimbolo (-1, row, column);

}

else / / if so is human machine vrs m making the move of the machine

{

mejorJugada (matrix, & row, & column) / / determine the best position to play

matrix [row] [col] =- 1 / / assign this position to Player 2

imprimirSimbolo (-1, row, column);

}

turn = 1 / / shift change player 1

}

}

else / / if the current position is occupied by a player

{

textcolor (YELLOW);

gotoxy (25.20);

printf ("");

gotoxy (25.20);

printf ("This cell ESTμ busy");

}

if (winner (matrix) == 1) / / if player 1 ¢ gan

{

gotoxy (27.4);

printf ("");

textcolor (LIGHTCYAN + BLINK);

gotoxy (25.20);

printf ("");

frame ();

gotoxy (28,20);

printf ("Player% s", jug1);

printf ("WIN");

key = 27;

}

if (winner (matrix) ==- 1) / / if player 2 ¢ gan

{

gotoxy (27.4);

printf ("");

textcolor (LIGHTRED + BLINK);

gotoxy (25.20);

printf ("");

frame ();

gotoxy (28,20);

printf ("Player% s", jug2);

printf ("WIN");

key = 27;

}

if (tie (matrix) == 1) / / if there was a tie

{

gotoxy (27.4);

printf ("");

textcolor (LightBlue + BLINK);

gotoxy (25.20);

printf ("");

frame ();

gotoxy (33:20);

printf ("DRAWN GAME");

key = 27;

}

delay (1000);

/ / If there was no winner or tie

if ((winner (matrix) == 0) & & (tie (matrix) == 0))

imprimirSimbolo (shift, row, column);

textcolor (WHITE);

break;

}

case 59: / / F1 View Credits

{

presentation ();

/ / Printing of the play area

textbackground (BLACK);

ClrScr ();

box (jug1, jug2, * mode);

for (ff = 0, ff <3 ff + +)

for (cc = 0; cc <3 cc + +)

imprimirSimbolo (matrix [ff] [cc], ff, cc);

imprimirSimbolo (shift, row, column);

break;

}

case 60: / / F2 SAVE GAME

{

/ / If there is no winner, no tie, and Mariz est not empty

if ((winner (matrix) == 0) & & (tie (matrix) == 0) & & (matrizVacia (matrix) == 1))

{

/ / Fill registration

for (ff = 0, ff <3 ff + +)

for (cc = 0; cc <3 cc + +)

registro.mat [ff] [cc] = matrix [ff] [cc];

for (cc = 0; cc <10; cc + +)

registro.nj1 [cc] = jug1 [cc];

for (cc = 0; cc <10; cc + +)

registro.nj2 [cc] = jug2 [cc];

registro.jug = shift;

registro.mod =* mode;

/ / Save to file

file (registry, file);

}

else / / if there is a herd or a tie or a matrix is ​​empty

{

textcolor (YELLOW);

gotoxy (25.20);

printf ("");

gotoxy (25.20);

printf ("YOU CAN NOT KEEP THIS GAME");

delay (1000);

}

/ / Printing of the play area

textbackground (BLACK);

ClrScr ();

box (jug1, jug2, * mode);

for (ff = 0, ff <3 ff + +)

for (cc = 0; cc <3 cc + +)

imprimirSimbolo (matrix [ff] [cc], ff, cc);

imprimirSimbolo (shift, row, column);

break;

}

case 61: / / Load Game F3

{

limpiarregistro (register) / / remove junk in the registry may

/ / Read data from the file to save registry

unarchive (® Istro, file, & error);

if (error == 0) / / if file is empty or est

{

limpiarMatrix (matrix) / / put the entire array to 0

/ / Fill the log file with information

for (int = 0 ff ff <3 ff + +)

for (int cc = 0; cc <3 cc + +)

matrix [ff] [cc] = registro.mat [ff] [cc];

ininombres (jug1, jug2);

for (cc = 0; cc <10; cc + +)

jug1 [cc] = registro.nj1 [cc];

for (cc = 0; cc <10; cc + +)

jug2 [cc] = registro.nj2 [cc];

row = 1;

column = 1;

registro.jug = shift;

* Mode = registro.mod;

}

/ / Printing of the play area

textbackground (BLACK);

ClrScr ();

box (jug1, jug2, * mode);

for (ff = 0, ff <3 ff + +)

for (cc = 0; cc <3 cc + +)

imprimirSimbolo (matrix [ff] [cc], ff, cc);

imprimirSimbolo (shift, row, column);

break;

}

}

} While (tecla! = 27) / / while the key is different from ESCAPE typed

}

/*------------------------------------------------ ------------------------------*/

/ / This function returns the number of occurrences of "num" in "line"

/ / Parameters:

/ / Matrix [] [3] matrix that is played

/ / Line line of the matrix in which to search

/ / Num item you want to search

int number (int matrix [] [3], int line, int num)

{

int cont = 0;

int l;

switch (line)

{

case 1: / / upper horizontal line

{

for (l = 0, l <3 l + +)

{

if (matrix [0] [l] == num)

cont + +;

}

break;

}

case 2: / / middle horizontal line

{

for (l = 0, l <3 l + +)

{

if (matrix [1] [l] == num)

cont + +;

}

break;

}

case 3: / / lower horizontal line

{

for (l = 0, l <3 l + +)

{

if (matrix [2] [l] == num)

cont + +;

}

break;

}

case 4: / / left vertical line

{

for (l = 0, l <3 l + +)

{

if (matrix [l] [0] == num)

cont + +;

}

break;

}

case 5: / / middle vertical line

{

for (l = 0, l <3 l + +)

{

if (matrix [l] [1] == num)

cont + +;

}

break;

}

case 6: / / right vertical line

{

for (l = 0, l <3 l + +)

{

if (matrix [l] [2] == num)

cont + +;

}

break;

}

case 7: / / diagonal line

{

for (l = 0, l <3 l + +)

{

if (matrix [l] [l] == num)

cont + +;

}

break;

}

case 8: / / backslash line

{

for (l = 0, l <3 l + +)

{

if (matrix [2-l] [l] == num)

cont + +;

}

break;

}

}

return (cont);

}

/*------------------------------------------------ ------------------------------*/

/ / This function returns the symbol of the winning player 1, -1 or 0 if no winner

/ / Parameters:

/ / Matrix [] [3] matrix that is played

int winner (int matrix [] [3])

{

int winner = 0;

if (number (matrix, 1, -1) == 3)

winner =- 1;

if (number (matrix, 2, -1) == 3)

winner =- 1;

if (number (matrix, 3, -1) == 3)

winner =- 1;

if (number (matrix, 4, -1) == 3)

winner =- 1;

if (number (matrix, 5, -1) == 3)

winner =- 1;

if (number (matrix, 6, -1) == 3)

winner =- 1;

if (number (matrix, 7, -1) == 3)

winner =- 1;

if (number (matrix, 8, -1) == 3)

winner =- 1;



if (number (matrix, 1.1) == 3)

winner = 1;

if (number (matrix, 2.1) == 3)

winner = 1;

if (number (matrix, 3.1) == 3)

winner = 1;

if (number (matrix, 4.1) == 3)

winner = 1;

if (number (matrix, 5.1) == 3)

winner = 1;

if (number (matrix, 6.1) == 3)

winner = 1;

if (number (matrix, 7.1) == 3)

winner = 1;

if (number (matrix, 8.1) == 3)

winner = 1;

return (winner);

}

/*------------------------------------------------ ------------------------------*/

/ / This function returns a 1 if there is a tie or a 0 if there is not

/ / Parameters:

/ / Matrix [] [3] matrix that is played

int draw (int matrix [] [3])

{

int emp;

int counter = 0;

int c, f;

/ / Determine if the matrix full est

for (f = 0, f <3, f + +)

for (c = 0, c <3, c + +)

{

if (matrix [f] [c]! = 0)

counter + +;

}

/ / If no winner and full est matrix

if ((winner (matrix) == 0) & & (count == 9))

emp = 1, / / ​​there is a tie

else

emp = 0, / / ​​there is a tie

return (emp);

}

/*------------------------------------------------ ------------------------------*/

/ / Function that returns a 1 if the gameplay is human vrs human and 2 if man vrs machine.

modoJuego int (void)

{

int option, key;

ClrScr ();

frame ();

/ / Print main menu

gotoxy (25.9);

printf ("Select the required option");

textcolor (LIGHTCYAN);

gotoxy (25.11);

printf ("1 - HUMAN vrs human game");

gotoxy (25.12);

printf ("2 - COMPUTER vrs human game");

gotoxy (25.13);

printf ("3 - EXIT GAME ');

textcolor (WHITE);

gotoxy (25:15);

printf ("Type in the number of the option:");

scanf ("% d", & option) / / option is the option chosen

return (option);

}

/*------------------------------------------------ ------------------------------*/

/ / This procedure determines the row and column where the machine is the best move,

/ / Either to win or to block the player wins 1 (human)

/ / Parameters:

/ / Matrix [] [3] is the matrix that is played

/ / * Row cell in the physical memory pointed to by row, and will change its value

/ / * Column cell in the physical memory pointed to by column, and will change its value

mejorJugada void (int matrix [] [3], int * row, int * column)

{

int f, c, ready / / indicates whether ¢ was already found the best move or not

int lin10, lin20, lin30, lin40, lin50, lin60, lin70, lin80;

int lin11, lin21, lin31, lin41, lin51, lin61, lin71, lin81;

int lin12, lin22, lin32, lin42, lin52, lin62, lin72, lin82;

ready = 0 / / still not found

/ / Number of cells VACOAS

lin10 = number (matrix, 1.0); / / at line 1

lin20 = number (matrix, 2.0) / / on line 2

lin30 = number (matrix, 3.0); / / in line 3

lin40 = number (matrix, 4.0); / / on line 4

lin50 = number (matrix, 5.0); / / on line 5

lin60 = number (matrix, 6.0) / / on line 6

lin70 = number (matrix, 7.0) / / 7 Online

lin80 = number (matrix, 8.0); / / on line 8

/ / Number of cells occupied by player 1

lin11 = number (matrix, 1.1) / / on line 1

lin21 = number (matrix, 2.1); / / on line 2

lin31 = number (matrix, 3.1); / / in line 3

lin41 = number (matrix, 4.1) / / on line 4

lin51 = number (matrix, 5.1) / / on line 5

lin61 = number (matrix, 6.1) / / on line 6

lin71 = number (matrix, 7.1) / / 7 Online

lin81 = number (matrix, 8.1) / / on line 8

/ / Number of cells occupied by THE MACHINE

lin12 = number (matrix, 1, -1) / / on line 1

lin22 = number (matrix, 2, -1) / / on line 2

lin32 = number (matrix, 3, -1) / / in line 3

lin42 = number (matrix, 4, -1) / / on line 4

lin52 = number (matrix, 5, -1) / / on line 5

lin62 = number (matrix, 6, -1) / / on line 6

lin72 = number (matrix, 7, -1) / / 7 Online

lin82 = number (matrix, 8, -1) / / on line 8

/ / PLAY TO WIN

/ / If line 1 is a 0 and -1 and two not found the best move

if ((lin10 == 1) & & (lin12 == 2) & & (done == 0))

{

/ / Find the position empty to

for (c = 0, c <3, c + +)

{

if (matrix [0] [c] == 0)

{

* Row = 0;

* Column = c;

ready = 1;

}

}

}

/ / If line 2 is a 0 and -1 and two not found the best move

else if ((lin20 == 1) & & (lin22 == 2) & & (done == 0))

{

/ / Find the position empty to

for (c = 0, c <3, c + +)

{

if (matrix [1] [c] == 0)

{

* Row = 1;

* Column = c;

ready = 1;

}

}

}

/ / If line 3 is a 0 and -1 and two not found the best move

else if ((lin30 == 1) & & (lin32 == 2) & & (done == 0))

{

/ / Find the position empty to

for (c = 0, c <3, c + +)

{

if (matrix [2] [c] == 0)

{

* Row = 2;

* Column = c;

ready = 1;

}

}

}

/ / If line 4 is a 0 and -1 and two not found the best move

else if ((lin40 == 1) & & (lin42 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [0] == 0)

{

* Row = f;

* Column = 0;

ready = 1;

}

}

}

/ / If line 5 is a 0 and -1 and two not found the best move

else if ((lin50 == 1) & & (lin52 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [1] == 0)

{

* Row = f;

* Column = 1;

ready = 1;

}

}

}

/ / If line 6 is a 0 and -1 and two not found the best move

else if ((lin60 == 1) & & (lin62 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [2] == 0)

{

* Row = f;

* Column = 2;

ready = 1;

}

}

}

/ / If line 7 is a 0 and -1 and two not found the best move

else if ((lin70 == 1) & & (lin72 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [f] == 0)

{

* Row = f;

* Column = f;

ready = 1;

}

}

}

/ / If line 8 is a 0 and two -1 and not found the best move

else if ((lin80 == 1) & & (lin82 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [2-f] == 0)

{

* Row = f;

* Column = 2-f;

ready = 1;

}

}

Else}

/ / MOVE TO BLOCK

/ / If line 1 is a 0 and two 1 and found the best move

if ((lin10 == 1) & & (lin11 == 2) & & (done == 0))

{

/ / Find the position empty to

for (c = 0, c <3, c + +)

{

if (matrix [0] [c] == 0)

{

* Row = 0;

* Column = c;

ready = 1;

}

}

}

/ / If line 2 is a 0 and two 1 and found the best move

else if ((lin20 == 1) & & (lin21 == 2) & & (done == 0))

{

/ / Find the position empty to

for (c = 0, c <3, c + +)

{

if (matrix [1] [c] == 0)

{

* Row = 1;

* Column = c;

ready = 1;

}

}

}

/ / If line 3 is a 0 and two 1 and found the best move

else if ((lin30 == 1) & & (lin31 == 2) & & (done == 0))

{

/ / Find the position empty to

for (c = 0, c <3, c + +)

{

if (matrix [2] [c] == 0)

{

* Row = 2;

* Column = c;

ready = 1;

}

}

}

/ / If line 4 is a 0 and two 1 and found the best move

else if ((lin40 == 1) & & (lin41 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [0] == 0)

{

* Row = f;

* Column = 0;

ready = 1;

}

}

}

/ / If line 5 is a 0 and two 1 and found the best move

else if ((lin50 == 1) & & (lin51 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [1] == 0)

{

* Row = f;

* Column = 1;

ready = 1;

}

}

}

/ / If line 6 is a 0 and two 1 and found the best move

else if ((lin60 == 1) & & (lin61 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [2] == 0)

{

* Row = f;

* Column = 2;

ready = 1;

}

}

}

/ / If line 7 is a 0 and two 1 and found the best move

else if ((lin70 == 1) & & (lin71 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [f] == 0)

{

* Row = f;

* Column = f;

ready = 1;

}

}

}

/ / If line 8 is a 0 and two 1 and found the best move

else if ((lin80 == 1) & & (lin81 == 2) & & (done == 0))

{

/ / Find the position empty to

for (f = 0, f <3, f + +)

{

if (matrix [f] [2-f] == 0)

{

* Row = f;

* Column = 2-f;

ready = 1;

}

}

}

else

{

/ / PUT IN ANY POSITION



if ((matrix [1] [0] == 1) & & (matrix [0] [1] == 1) & & (matrix [0] [0] == 0))

{

* Row = 0;

* Column = 0;

} Else if ((matrix [1] [0] == 1) & & (matrix [2] [1] == 1) & & (matrix [2] [0] == 0))

{

* Row = 2;

* Column = 0;

} Else if ((matrix [2] [1] == 1) & & (matrix [1] [2] == 1) & & (matrix [2] [2] == 0))

{

* Row = 2;

* Column = 2;

} Else if ((matrix [0] [1] == 1) & & (matrix [1] [2] == 1) & & (matrix [0] [2] == 0))

{

* Row = 0;

* Column = 2;

} Else if ((matrix [1] [1] == 1) & & (matrix [0] [0] == 0))

{

* Row = 0;

* Column = 0;

} Else if ((matrix [1] [1] == 1) & & (matrix [2] [2] == 1) & & (matrix [0] [2] == 0))

{

* Row = 0;

* Column = 2;

} Else if (matrix [1] [1] == 0)

{

* Row = 1;

* Column = 1;

} Else if (matrix [0] [1] == 0)

{

* Row = 0;

* Column = 1;

} Else if (matrix [1] [0] == 0)

{

* Row = 1;

* Column = 0;

} Else if (matrix [1] [2] == 0)

{

* Row = 1;

* Column = 2;

} Else if (matrix [2] [1] == 0)

{

* Row = 2;

* Column = 1;

} Else if (matrix [0] [0] == 0)

{

* Row = 0;

* Column = 0;

} Else if (matrix [2] [2] == 0)

{

* Row = 2;

* Column = 2;

} Else if (matrix [0] [2] == 0)

{

* Row = 0;

* Column = 2;

} Else if (matrix [2] [0] == 0)

{

* Row = 2;

* Column = 0;

}

}

}

/*------------------------------------------------ ------------------------------*/

/ / This procedure handles the reading of names of players

/ / Parameters:

/ / Mode gameplay

/ / Nomb1 [] name of player 1

/ / Nomb2 [] name of player 2

void name (int mode, char nomb1 [], char nomb2 [])

{

ininombres (nomb1, nomb2) / / delete the contents of name names

gotoxy (25.17);

printf ("PLAYER NAME 1 (HUMAN)");

scanf ("% s", nomb1);

gotoxy (25.19);

if (mode == 1)

printf ("NAME PLAYER 2 (HUMAN)");

else if (mode == 2)

printf ("NAME PLAYER 2 (machine):");

scanf ("% s", nomb2);



}

/*------------------------------------------------ ------------------------------*/

/ / Put the name of the players in white

/ / Parameters:

/ / Nomb1 [] name of player 1

/ / Nomb2 [] name of player 2

ininombres void (char nomb1 [], char nomb2 [])

{

for (int i = 0; i <15; i + +)

{

nomb1 [i] = '';

nomb2 [i] = '';

}

}

/*------------------------------------------------ ------------------------------*/

/ / This procedure handles the game save to a file

/ / Parameters:

/ / Data1 that contains the data to save

/ / Archive files that are saved games

void archive (data1 structure, files, file)

{

int space; / / position in which you save the game

nombrea char [10];

imprimirGuardados (file);

textcolor (YELLOW);

textcolor (YELLOW);

/ / Print menu to save games £

gotoxy (1.1);

printf ("SAVE MENU");

gotoxy (1.11);

printf ("# SPACE TO SAVE");

gotoxy (22.11);

printf ("");

gotoxy (22.11);

scanf ("% d", & space);

gotoxy (4, space +1);

printf ("");

gotoxy (4, space +1);

scanf ("% s", nombrea);

textbackground (BLACK);

switch (space)

{

case 1: / / save the file save1

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save1 = fopen ("A: save1.dat", "w");

if (archivo.save1 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save1);

fclose (archivo.save1);

break;

}

case 2: / / save the file save2

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save2 = fopen ("A: save2.dat", "w");

if (archivo.save2 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save2);

fclose (archivo.save2);

break;

}

case 3: / / save the file save3

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save3 = fopen ("A: save3.dat", "w");

if (archivo.save3 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save3);

fclose (archivo.save3);

break;

}

case 4: / / save to file save4

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save4 = fopen ("A: save4.dat", "w");

if (archivo.save4 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save4);

fclose (archivo.save4);

break;

}

case 5: / / save to file save5

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save5 = fopen ("A: save5.dat", "w");

if (archivo.save5 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save5);

fclose (archivo.save5);

break;

}

case 6: / / save to file save6

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save6 = fopen ("A: save6.dat", "w");

if (archivo.save6 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save6);

fclose (archivo.save6);

break;

}

case 7: / / save to file save7

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save7 = fopen ("A: save7.dat", "w");

if (archivo.save7 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save7);

fclose (archivo.save7);

break;

}

case 8: / / save to file save8

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save8 = fopen ("A: save8.dat", "w");

if (archivo.save8 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save8);

fclose (archivo.save8);

break;

}

case 9: / / save the file save9

{

for (int cc = 0; cc <10; cc + +)

datos1.narch [cc] = nombrea [cc];

archivo.save9 = fopen ("A: save9.dat", "w");

if (archivo.save9 == NULL)

printf ("nError: Can not open file");

else

fwrite (& data1, sizeof (struct structure), 1, archivo.save9);

fclose (archivo.save9);

break;

}

default:

{

gotoxy (1.12);

printf ("ERROR: NO");

delay (1000);

}

}

}

/*------------------------------------------------ ------------------------------*/

/ / This procedure is responsible for loading the game from a file and save it in a register

/ / Parameters:

/ / Data2 record will contain the game data

/ / Archive files that are saved games

/ / * Error indicates if an error occurs when loading files

unarchive void (* data2 structure, files, file, int * error)

{

int space;

nombrea char [10];

* Error = 0;

imprimirGuardados (file);

/ / Print menu to load games £

textcolor (YELLOW);

gotoxy (1.1);

printf ("LOAD MENU");

textcolor (YELLOW);

gotoxy (1.11);

printf ("# game to load:");

gotoxy (19.11);

printf ("");

gotoxy (19.11);

scanf ("% d", & space);

/ / File to be loaded

switch (space)

{

case 1: / / upload the file save1

{

archivo.save1 = fopen ("A: save1.dat", "r");

if (archivo.save1 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save1);

fclose (archivo.save1);

break;

}

case 2: / / upload the file save2

{

archivo.save2 = fopen ("A: save2.dat", "r");

if (archivo.save2 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save2);

fclose (archivo.save2);

break;

}

case 3: / / upload the file save3

{

archivo.save3 = fopen ("A: save3.dat", "r");

if (archivo.save3 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save3);

fclose (archivo.save3);

break;

}

case 4: / / upload the file save4

{

archivo.save4 = fopen ("A: save4.dat", "r");

if (archivo.save4 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save4);

fclose (archivo.save4);

break;

}

case 5: / / upload the file save5

{

archivo.save5 = fopen ("A: save5.dat", "r");

if (archivo.save5 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save5);

fclose (archivo.save5);

break;

}

case 6: / / upload the file save6

{

archivo.save6 = fopen ("A: save6.dat", "r");

if (archivo.save6 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save6);

fclose (archivo.save6);

break;

}

case 7: / / upload the file save7

{

archivo.save7 = fopen ("A: save7.dat", "r");

if (archivo.save7 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save7);

fclose (archivo.save7);

break;

}

case 8: / / upload the file save8

{

archivo.save8 = fopen ("A: save8.dat", "r");

if (archivo.save8 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save8);

fclose (archivo.save8);

break;

}

case 9: / / upload the file save9

{

archivo.save9 = fopen ("A: save9.dat", "r");

if (archivo.save9 == NULL)

{

gotoxy (1.12);

printf ("ERROR: EMPTY ESTμ");

delay (1000);

* Error = 1;

}

else

fread (& * data2, sizeof (struct structure), 1, archivo.save9);

fclose (archivo.save9);

break;

}

}

}

/*------------------------------------------------ ------------------------------*/

/ / Function that returns a 0 if the array is empty or 1 if not est.

/ / Parameters:

/ / Matrix [] [3] is the matrix that is played

matrizVacia int (int matrix [] [3])

{

int result = 0;

for (int f = 0, f <3, f + +)

for (int c = 0, c <3, c + +)

if (matrix [f] [c]! = 0)

result = 1;

return result;

}

/*------------------------------------------------ ------------------------------*/

/ / Procedure that cleans the contents of the log

/ / Parameters:

/ / Data record to be clean

void limpiarregistro (data structure)

{

for (int = 0 ff ff <3 ff + +)

for (int cc = 0; cc <3 cc + +)

datos.mat [ff] [cc] = 0;

for (cc = 0; cc <10; cc + +)

{

datos.nj1 [cc] = '';

datos.nj2 [cc] = '';

datos.narch [cc] = '';

}

datos.jug = 0;

datos.mod = 0;

}

/*------------------------------------------------ ------------------------------*/

/ / This procedure displays a list of files saved games

/ / Parameters:

/ / File are the files that are saved games

imprimirGuardados void files (file)

{

data structure;

textbackground (BLUE);

textcolor (BLUE);

for (int x = 1, x <= 23, x + +)

for (int y = 1, and <13, and + +)

{

gotoxy (x, y);

printf ("u");

}

textcolor (LIGHTCYAN);

limpiarregistro (data);

/ / NAME WITH THAT SAVE GAME 1

gotoxy (1.2);

printf ("1 -");

archivo.save1 = fopen ("A: save1.dat", "r");

gotoxy (4.2);

if (archivo.save1 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save1);

printf ("% s", datos.narch);

fclose (archivo.save1);

}

limpiarregistro (data);

/ / Name given to Save the file 2

gotoxy (1.3);

printf ("2 -");

archivo.save2 = fopen ("A: save2.dat", "r");

gotoxy (4.3);

if (archivo.save2 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save2);

printf ("% s", datos.narch);

fclose (archivo.save2);

}

limpiarregistro (data);

/ / Name given to Save the file 3

gotoxy (1.4);

printf ("3 -");

archivo.save3 = fopen ("A: save3.dat", "r");

gotoxy (4.4);

if (archivo.save3 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save3);

printf ("% s", datos.narch);

fclose (archivo.save3);

}

limpiarregistro (data);

/ / Name given to Save the file 4

gotoxy (1.5);

printf ("4 -");

archivo.save4 = fopen ("A: save4.dat", "r");

gotoxy (4.5);

if (archivo.save4 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save4);

printf ("% s", datos.narch);

fclose (archivo.save4);

}

limpiarregistro (data);

/ / Name given to Save the file 5

gotoxy (1.6);

printf ("5 -");

archivo.save5 = fopen ("A: save5.dat", "r");

gotoxy (4.6);

if (archivo.save5 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save5);

printf ("% s", datos.narch);

fclose (archivo.save5);

}

limpiarregistro (data);

/ / Name given to Save the file 6

gotoxy (1.7);

printf ("6 -");

archivo.save6 = fopen ("A: save6.dat", "r");

gotoxy (4.7);

if (archivo.save6 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save6);

printf ("% s", datos.narch);

fclose (archivo.save6);

}

limpiarregistro (data);

/ / Name given to Save the file 7

gotoxy (1.8);

printf ("7 -");

archivo.save7 = fopen ("A: save7.dat", "r");

gotoxy (4.8);

if (archivo.save7 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save7);

printf ("% s", datos.narch);

fclose (archivo.save7);

}

limpiarregistro (data);

/ / Name given to Save the file 8

gotoxy (1.9);

printf ("8 -");

archivo.save8 = fopen ("A: save8.dat", "r");

gotoxy (4.9);

if (archivo.save8 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save8);

printf ("% s", datos.narch);

fclose (archivo.save8);

}

limpiarregistro (data);

/ / Name given to Save the file 9

gotoxy (1.10);

printf ("9 -");

archivo.save9 = fopen ("A: save9.dat", "r");

gotoxy (4.10);

if (archivo.save9 == NULL) / / if empty print file does not exist

printf ("[empty]");

else

{

fread (& data, sizeof (struct structure), 1, archivo.save9);

printf ("% s", datos.narch);

fclose (archivo.save9);

}

limpiarregistro (data);

}

/*------------------------------------------------ ------------------------------*/

/ / Procedure to print the presentation at the beginning and press F1 during a game

presentation void (void)

{

ClrScr ();

textcolor (LIGHTCYAN);

gotoxy (23.5);

printf ("ALAJUELA COLLEGE");

delay (10);

gotoxy (36.6);

printf ("(COT)");

delay (10);

gotoxy (33.7);

printf ("prepared by:");

delay (10);

textcolor (YELLOW);

gotoxy (30.8);

printf ("FREDDY LEON SALAZAR");

delay (10);

gotoxy (36.9);

printf ("20020188");

delay (10);

textcolor (LIGHTCYAN);

gotoxy (30.10);

printf ("Project Program");

delay (10);

textcolor (YELLOW);

gotoxy (29.11);

printf ("COURSE SCHEDULE 2");

delay (10);

gotoxy (22.12);

printf ("TEACHER: Chaco GEOVANNY RODRIGUEZ");

delay (10);

gotoxy (31.13);

textcolor (LIGHTCYAN);

printf ("III TERM");

delay (10);

gotoxy (38.14);

printf ("2002");

gotoxy (79.25);

frame ();

delay (3000);

}

/*------------------------------------------------ ------------------------------*/

/ / Prints the bar keys that can be used in the bottom of the screen during the game

void help (void)

{

textbackground (BLUE);

gotoxy (1.25);

clreol ();

textcolor (LIGHTGREEN);

gotoxy (2.25);

printf ("ENTER");

textcolor (WHITE);

gotoxy (7.25);

printf ("Location");

textcolor (LIGHTGREEN);

gotoxy (16.25);

printf ("ESCAPE");

textcolor (WHITE);

gotoxy (23,25);

printf ("wiggle");

textcolor (LIGHTGREEN);

gotoxy (30.25);

printf ("% c", 27);

gotoxy (31.25);

printf ("% c", 26);

gotoxy (32.25);

printf ("% c", 24);

gotoxy (33.25);

printf ("% c", 25);

textcolor (WHITE);

gotoxy (35.25);

printf ("MOVE");

textcolor (LIGHTGREEN);

gotoxy (43:25);

printf ("F1");

textcolor (WHITE);

gotoxy (46.25);

printf ("Credit");

textcolor (LIGHTGREEN);

gotoxy (57.25);

printf ("F2");

textcolor (WHITE);

gotoxy (60.25);

printf ("SAVE");

textcolor (LIGHTGREEN);

gotoxy (70.25);

printf ("F3");

textcolor (WHITE);

gotoxy (73.25);

printf ("load");

textbackground (BLACK);

}

/*------------------------------------------------ ------------------------------*/

/ / Prints the outer frame

void frame (void)

{



for (int x = 1, X <= 79, X + +)

for (int y = 1, Y <= 24, Y + +)

{

if ((x == 1) | | (x == 79) | | (Y == 1) | | (y == 24))

{

gotoxy (X, Y);

printf ("UU");

}

}

}

/*------------------------------------------------ ------------------------------*/

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Premium Wordpress Themes