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()
{
int answer1; //variable1
cout<<"What is 2+2?"; //Ya betta know that one!
cin>>answer1; //here's where the value goes into our trusty variable, answer1
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!";
int answer2; //variable2
cout<<"What is 4+4?"; //a little bit harder
cin>>answer2; //here's where the value goes into our trusty variable, answer2
if(answer2==8) //if the user puts in 8, it will be correct
{
cout<<"Correct again! You must be mega smart!";
int answer3; //variable3
cout<<"What is 8+8?"; //now we're gettin to the real hard parts ;)
cin>>answer3; //here's where the value goes into our trusty variable, answer3
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!";
int answer4; //variable 4
cout<<"What is 5x5?";
cin>>answer4; //here's where the value goes into our trusty variable, answer4
if(answer4==25) //if the user puts in 25, it will be correct
{
cout<<"You truly are amazing.";
int answer5; //variable 5
cout<<"What is 10x10?";
cin>>answer5; //here's where the value goes into our trusty variable, answer5
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.";
int answer6; //variable 6
cout<<"What is 1000x1000?";
cin>>answer6; //here's where the value goes into our trusty variable, answer6
if(answer6==1000000) //if the user puts in 1000000, it will be correct
{
cout<<"AWESOME!!!!!!!!!!!!!! You win!!!! NOT!!!!! Here is the final question.";
int answer7; //variable 7
cout<<"What is 5+5-2+301-29x50?";
cin>>answer7; //here's where the value goes into our trusty variable, answer7
if(answer7==14000)
{
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