Hi there,
I have to make a game of Rock Paper Scissors using the IF statement. Two players.
So far this is what I have :-
Code:
#include <iostream>
using namespace std;
int main()
{
int playerone;
int playertwo;
cout << "Player 1, please enter '1' for Rock, '2' for Paper or '3' for Scissors and then press Enter ";
cin >> playerone;
cin.ignore();
cout << "Player 2, please enter '1' for Rock, '2' for Paper or '3' for Scissors and then press Enter ";
cin >> playertwo;
cin.ignore();
if (playerone == '1' + playertwo == '2')
{
cout << "Player two wins";
else if (playerone == '1' + playertwo == '3');
cout << "Player one wins";
else
cout << "you made an error";}
cin.get();
When I enter 1,2,or 3 it just keeps saying 'you made an error", now isn't even compiling as it says "23 expected primary-expression before "else" ".
Buggy.
Thanks for any help.
smiley.jpg