this is a game of tic-tac-toe that i made it was my firstr attemt at writing a c++ program please tell me what you think
Printable View
this is a game of tic-tac-toe that i made it was my firstr attemt at writing a c++ program please tell me what you think
I'd like to try your game but dunno its rules...:( maybe I need a readme. :o
- goto statements
Don't use them. They're OK in special cases, but in a program of this size, they're not needed.
- toe variable
You can tidy your declaration of this variable like so:
>toe[]={'1','2','3','4', etc
- cout << "\033[2J";
That didn't work properly on my system. There must be a safer equivalent.
- cout<<toe[6]<<" | "<<toe[7]<<" | "<<toe[8]<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<< endl<<endl;
Maybe a loop would look better?
Use "else if", that way once a match is found, the rest of the if stataments will be bypassed. This is a small and pointless efficiency change in a program of this size, but still good to know for future development.Code:if (toe[0]==b && toe[1]==b && toe[2]==b)
w=1;
if (toe[3]==b && toe[4]==b && toe[5]==b)
w=1;
All in all, I've seen a lot worse tic-tac-toe programs, so it's a good start :)
It's cool.:)
The keys is your numpad keys... That figured out
try to put the keys on the screen before you play the game
possible bug : if you choose the 1'st block, it gives a strange character.
i tred this but i got these too erors backQuote:
You can tidy your declaration of this variable like so:
>toe[]={'1','2','3','4', etc
error C2059: syntax error : ']'
error C2001: newline in constant
can you tell me what i did wrongCode:toe[]={'1','2','3','4,'5','6','7','8','9'};
thanks biosninja i fixed what you found about the first square
black: i am making in a in game help sequence that will tell you how to play i will post an updated version a soon as i get my erors fixxed
Initliasing the toe variable...
orCode:#include <stdio.h>
int main(void)
{
char toe[] = {'1','2','3','4','5','6','7','8','9'};
int i;
for (i = 0; i < sizeof (toe); i++)
printf ("%c\n", toe[i]);
return 0;
}
Code:#include <stdio.h>
int main(void)
{
char toe[9];
int i;
for (i = 0; i < sizeof (toe); i++)
toe[i] = (char)(i + 1 + '0');
for (i = 0; i < sizeof (toe); i++)
printf ("%c\n", toe[i]);
return 0;
}
I don't know why I'm crying. It just makes me happy when a newbie posts his game(didn't download it). I just wish atleast 50% of the world population would be programmers and not casual gamers who think graphics rule......
wtf are you talking about?