Ok, first off, here's my code for a non-random rock, paper scissors game.
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int x;
int y;
int z;
cout<<"Ok! It's time time play! It's 1 to play rock, 2 to play scissors and 3 to play paper! 1, 2, 3 GO!\n";
cin>> x;
if ( x == 2 ) {
cout<<"No! You won the first round! How could you, now it's time for you to die!\n";
cin.get();
}
else if ( x == 3 ) {
cout<<"A draw? Pah! We must pick once again!\n";
cin>> x;
if ( x == 2 ) {
cout<<"You.. You won! You can't! but I'll win the 2nd round!\n";
cin.get();
}
else {
cout<<"I won loser! Next round!\n";
cin.get();
}
}
else {
cout<<"Yes! I win, loser. Na na na na na! Better luck next time, loser!\n";
cin.get();
}
//First round complete! Now to do the second one!
cout<<"Now, onto the second round! Pick once again please!\n";
cin>> y;
if ( x == 2 && y == 3 ) {
cout<<"No! You've won the whole thing! How dare you!\n";
exit(0);
}
else if ( x == 1 && y == 2 ) {
cout<<"YES! Losers! I've won everything!\n";
exit(0);
}
else if ( y == 3 ) {
cout<<"No! You won the first round! How could you, now it's time for you to die!\n";
cin.get();
}
else if ( y == 1 ) {
cout<<"A draw? Pah! We must pick once again!\n";
cin>> x;
if ( y == 3 ) {
cout<<"You.. You won! You can't! but I'll win the 3rd round!\n";
cin.get();
}
else {
cout<<"I won loser! Next round!\n";
cin.get();
}
}
else {
cout<<"Yes! I win, loser. Na na na na na! Better luck next time, loser!\n";
cin.get();
}
//Second round done! Now to do the third one!
cout<<"Now, the final round, exciting eh? Whoever wins this wins everything!\n";
cin.get();
if ( z == 2 ) {
cout<<"No! You've won everything!\n";
cin.get();
}
else if ( z == 3 ) {
cout<<"A draw? Pah! We must pick once again!\n";
cin>> x;
if ( z == 2 ) {
cout<<"You.. You won! You can't! NO!\n";
cin.get();
}
else {
cout<<"Yes! I've won everything! Now it's time!\n";
cin.get();
}
}
else {
cout<<"Yes! I've won everything! Now it's time!\n";
cin.get();
}
}
The thing about it is that I want to exit if you win in the first 2 rounds but if you get them riht it instantly cuts off and I want the user to press enter before it cuts off. I've underline the place wher I'm confused at. I've been trying different things for about quarter of an hour so please tell me how, thanks.