1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include <iostream> //basic input and output
#include <windows.h> //allows us to change text and background color
using namespace std;
void clearboard (void)
{
char board[5][5] = {{' ','|',' ','|',' '},
{'-','-','-','-','-'},
{' ','|',' ','|',' '},
{'-','-','-','-','-'},
{' ','|',' ','|',' '}};
}
void printboard(char board[5][5])
{
for(int n=0;n<5;n++)
{
for(int m=0;m<5;m++)
{
std::cout << board[n][m];
}
std::cout << std::endl;
}
}
int main()
{
srand (time(NULL)); //makes 5 traps random
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); //enables us to change text and background color
char board[5][5];
cout<<" ";
SetConsoleTextAttribute(hConsole, ( BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY | FOREGROUND_BLUE | FOREGROUND_INTENSITY));
cout<<" TIC TAC TOE "<<endl;
SetConsoleTextAttribute(hConsole, (FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY));
system("pause");
clearboard();
printboard(board);
system("pause");
return 0;
}
|