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
|
enum ConsoleColor { //from http://www.cplusplus.com/articles/2ywTURfi/
BLACK=0,
DARK_BLUE=1,
DARK_GREEN=2,
DARK_AQUA,DARK_CYAN=3,
DARK_RED=4,
DARK_PURPLE=5,DARK_PINK=5,DARK_MAGENTA=5,
DARK_YELLOW=6,
DARK_WHITE=7,
GRAY=8,GREY=8,
BLUE=9,
GREEN=10,
AQUA=11,CYAN=11,
RED=12,
PURPLE=13,PINK=13,MAGENTA=13,
YELLOW=14,
WHITE=15
};
char dispgrid() //Displays the grid
{
for (int i=0;i<10;i++)
{
cout << "\n";
for(int j=0;j<10;j++)
{
char color;
char tileValue = grid[i][j];
switch (tileValue) {
case 'M':
color = ...; //choose a color from ConsoleColor, ex. color = RED;
break;
case 'H':
color = ...; //choose a color from ConsoleColor, ex. color = GREEN;
break;
default:
color = GRAY;
break;
}
cout << setcolor(color) << tileValue << " ";
}
}
}
|