Thread: it's not much of a game, but...

1. it's not much of a game, but...

here is my very first game. it's a math game, and doesent even use graphics (i dont know how to put them in yet) but just asks you a series of questions and says something (different each time) and ends. it says some pretty stupid things, but im just happy it worked. dont bother with it if you're offended by 'dumbum!' im not sure if this is how you're supposed to post games, so tell me if im supposed to attach a file or something instead.

Code:
```#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

cout<<"What is 2+2?";  //Ya betta know that one!

if(answer1==4)  //if the user puts in 4, it will be correct

{

cout<<"You are right. 2+2=4. Very good! You are very smart! Now onto the next question!";

cout<<"What is 4+4?";  //a little bit harder

if(answer2==8)  //if the user puts in 8, it will be correct

{

cout<<"Correct again! You must be mega smart!";

cout<<"What is 8+8?";  //now we're gettin to the real hard parts ;)

if(answer3==16)  //if the user puts in 16, it will be correct

{

cout<<"You're right again! Awesome! Now it's time for multiplication!";

cout<<"What is 5x5?";

if(answer4==25)  //if the user puts in 25, it will be correct

{

cout<<"You truly are amazing.";

cout<<"What is 10x10?";

if(answer5==100)  //if the user puts in 100, it will be correct

{

cout<<"Ultimate. You have passed all the tests I have given you. Now it is time to pass the hardest one of all.";

cout<<"What is 1000x1000?";

if(answer6==1000000)  //if the user puts in 1000000, it will be correct

{

cout<<"AWESOME!!!!!!!!!!!!!! You win!!!! NOT!!!!! Here is the final question.";

cout<<"What is 5+5-2+301-29x50?";

{

cout<<"You are very right. You have really won this time!";

}

else

{

cout<<"You are very wrong. You really haven't won this time!";

}

}

else

{

cout<<"Hahaha, I knew you'd lose at the ultimate question. Hahaha!";

}

}

else

{

cout<<"You got pretty far, but now you die!";

}

}

else

{

cout<<"You lose. Goodbye.";

}

}

else

{

cout<<"Wrong! Goodbye!";

}

}

else

{

cout<<"Wrong on the second question, what a shame...";  //You lose!

}

}

else

{

cout<<"You are wrong you stupid dumbum. Get outta here!";  //This happens if the answer is anything but 2

}

system("PAUSE");

return 0;

}```
stick it in your compiler and enjoy!

Code tags amended by Hammer

2. Hmm, it looks nice. But to make the code more readable, you might want to create a bool variable that keeps whether or not the last question was right. Like this:
Code:
```int response;
bool rightSoFar = true;

cout << "What is 2+2?\n";
cin >> response;
if(response == 4)
cout << "Right!\n";
else
{
cout << "Wrong, dumbo!";
rightSoFar = false;
}

if(rightSoFar)
{
cout << (next question);
cin >> response;
if(response is right)
cout << "Right!\n";
else
{
cout << "Wrong!\n";
rightSoFar = false;
}
}

if(rightSoFar)
{
//same as last one
}```
and so on. It just helps to make the code more readable; the way it is, it's really hard to find out what response goes with what question, since the response to the first question is several pages down

P.S. Actually, yes you're supposed to attach a file Most people don't want to bother compiling code.

3. i guess most people are different from me then, because i usually dont want to download

P.S. i meant to fix the code tags for the first post, but for some reason it said that the post didnt exist when i tried to edit it. it was weird...

4. I'd rather download an exe and source than have to cut, copy, paste, compile and run myself Too much effort

Plus there is no surprise as to what the program does anymore hehe

5. well you COULD close your eyes!

6. Lol, i tried that, but i couldn't see what i was doing

7. ah, good point!