I have to make a rock, paper, scissors program. It is basically done, but it doesn't tell the user which selection the cpu picked. How do I return the selection? I honestly don't know what I am doing.
int main()
{
int computerSelection = 0;
int userSelection = 0;
computerSelection = 1+rand()%3 +1 ;
string computerDescription = " ";
char playYN = 'Z';
userSelection = 0;
void getComputerDescription(int &computerSelection);
cout << "Do you want to play rock, paper, scissors? (Y/N) ";
cin >> playYN;
while (playYN == 'Y' || playYN == 'y')
{
computerSelection = 1+rand()%3;
getComputerDescription(computerSelection);
cout << "Please enter the number of your selection; 1 for rock, 2 for paper, 3 for scissors" << endl;
cin >> userSelection;
cout << "The computer selected " << computerDescription << endl;
if ( computerSelection == 1 && userSelection == 3 || computerSelection == 3 && userSelection == 1)
cout << "Rock wins because rock crushes scissors!" << endl;
else if ( computerSelection == 2 && userSelection == 3 || computerSelection == 3 && userSelection == 2)
cout << "Scissors win because scissors cut paper!" << endl;
else if ( computerSelection == 1 && userSelection == 2 || computerSelection == 2 && userSelection == 1)
cout << "Paper wins because paper covers rock!" << endl;
else
cout << "We have a tie! Play again!" << endl;