Help please!
How do I change this so I input the letters instead of numbers?
I'm confused. I want to make it so I can enter "R" instead of "0" etc. Also, I don't know where to put an if-break for the user to enter "Q" or "q"...
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
srand(time(0));
int R = 0; //rock
int P = 1; //paper
int S = 2; //scissors
int choice;
int compchoice = (rand()%2) + 1;
cout << "Choose: [Rock,Paper,Scissors,Quit]: ";
cout << "R for rock, P for paper, S for scissors, or Q for quit\n";
cin >> choice;
if (choice == R)
{
if (compchoice == R)
cout << "It's a tie!\n\n\n\n";
else if (compchoice == P)
cout << "Paper beats rock! Sorry, you lose!\n\n\n\n";
else if (compchoice == S)
cout << "Rock beats scissors! You win!\n\n\n\n";
}
if (choice == P)
{
if (compchoice == R)
cout << "It's a tie!\n\n\n\n";
else if (compchoice == P)
cout << "Paper beats rock! You win!\n\n\n\n";
else if (compchoice == S)
cout << "Scissors beat paper! Sorry, you lose!\n\n\n\n";
}
if (choice == S)
{
if (compchoice == R)
cout << "It's a tie!\n\n\n\n";
else if (compchoice == P)
cout << "Scissors beat paper! You win!\n\n\n\n";
else if (compchoice == S)
cout << "Rock beats scissors! Sorry, you lose!\n\n\n\n";
}
return 0;
}