First you want to put your code in [CODE][/CODE] brackets. It makes everything easier to read.
system ("TITLE Guess my number");
If you want to change the console window title use SetConsoleTitle(). Using system is bad practice. I don't think this is even a valid command.
system ("COLOR 2");
Once again if you want to change the console window color, use SetConsoleTextAttributes() and GetStdHandle(). Also I don't think this is a valid command.
system ("pause screen");
I don't think "pause screen" even dose anything. If you want it to pause, use something else. I recommend std::getchar() to start after getting input or Sleep() if you just want a delay.
system ("pause");
This is not wrong, but if you want to pause the screen read the above.
system ("cls");
WM_SETTEXT + PostMessage() for now. I forgot the other way to clear text.
do
{
...
}
Your statement is missing a while keyword and a condition.
return 0;
This should be right before your last curly bracket ( } ).
case '6':
cout << "Holy freakin crap dude u guessed my freakin number!!!!\n";
cout << "dude you are AWSOME!!!\n";
All your case statements are missing break keywords.
case '1':
cout << "dude your gonna have to do better than that\n";
cout << "try again\n";
case '2':
cout << "dude your gonna have to do better than that\n";
cout << "try again\n";
case '3':
cout << "dude your gonna have to do better than that\n";
cout << "try again\n";
Instead of having 3 of these, you should put them together.
The RED is what keeps you from compiling.
The YELLOW you will notice when you run your program
The GREEN is just bad programming. Or at least the ones I can point out without changing your entire code.
EDIT
system ("pause screen");{
You also have a { there for no reason.
EDIT
Now looking over your code, I see that you have a lot of pointless things in there. Like asking if they want to play your guessing game and then guessing a number. Why not just skip asking if they want to play and just make them guess the number. Then you only have 1 guess and its over. I also see a lot of senseless system("pause screen") in there. This is a text game, slowing the game down would be even worse.



LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks