Ok. I've got this Tic Tac Toe program to write for class, and so far this is what I have:
/*Include Statements*/
#include <stdio.h>
#include <string.h>
/*Data Structures*/
struct GAME
{
char location[3][3];
};
/*Function Prototypes*/
void displayboard(GAME pos);
void setblank(GAME positionfunct);
/*Main Function*/
int main(void)
{
/*Variable Declaration*/
GAME position;
/*Sets all of the Mark Locations to a Blank Space*/
setblank(position);
displayboard(position);
return 0;
}
void setblank(GAME positionfunct)
{
int a;
for(a==0; a<3; a++)
{
positionfunct.location[0][a] = ' ';
positionfunct.location[1][a] = ' ';
positionfunct.location[2][a] = ' ';
}
return;
}
void displayboard(GAME pos)
{
printf("\n\t\t\t Columns");
printf("\n\t\t\t 1 2 3\n");
printf("\n\t\t\t | |");
printf("\n\t\t\t 1 %c | %c | %c", pos.location[0][0], pos.location[1][0], pos.location[2][0]);
printf("\n\t\t\t | |");
printf("\n\t\t\tR =================");
printf("\n\t\t\to | |");
printf("\n\t\t\tw 2 %c | %c | %c", pos.location[0][1], pos.location[1][1], pos.location[2][1]);
printf("\n\t\t\ts | |");
printf("\n\t\t\t =================");
printf("\n\t\t\t | |");
printf("\n\t\t\t 3 %c | %c | %c", pos.location[0][2], pos.location[1][2], pos.location[2][2]);
printf("\n\t\t\t | |");
return;
}
Now, I know that all it is going(or should) do is display the empty board...but its not working right. When I try to run the program, it compiles and executes with no errors (VC++ 6.0), but then my screen will turn to this maroonish color, and the mouse will become an off white square. It goes without saying that I can't access anything during this and have no choice but to hit the reset button. I really don't see where my problems could be coming from? I mean, I understand that the code I have isn't great, but I'm learning about multi dimentional arrays on my own. I have no idea what is going on...I'm not fooling with the output in any way that should produce color, change the mouse, or even leave the little 80 character wide window.
Please...help?
- Pat