why does the 'else' statement on this code only work on the 'if' statement before it. I want it to work for all the 'if' statements in the code (that is, if none of the 'if' statements is true, then the else statement should execute). If that is not possible, then how it can be done?
cout<<"Type R for Rock\n"<<"Type P for Paper\n"<<"Type S for Scissors"<<endl; string P="Paper"; string R="Rock"; string S="Scissors"; string Player1; string Player2; cout<<"Player 1 Choose your Weapon\n"; cin>>Player1; cout<<"Player 2 Choose your Weapon\n"; cin>>Player2; if (Player1=="P"){ if (Player2=="R"){ cout<<"Player 1 acquires "<<P<<endl<<"Player 2 acquires "<<R<<endl<<"Player 1 wins ";}} if (Player1=="P"){ if (Player2=="S"){ cout<<"Player 1 acquires "<<P<<endl<<"Player 2 acquires "<<S<<endl<<"Player 2 wins "; }} if (Player1=="R"){ if (Player2=="P"){ cout<<"Player 1 acquires "<<R<<endl<<"Player 2 acquires "<<P<<endl<<"Player 2 wins "; }} if (Player1=="R"){ if (Player2=="S"){ cout<<"Player 1 acquires "<<R<<endl<<"Player 2 acquires "<<S<<endl<<"Player 1 wins "; }} if (Player1=="S"){ if (Player2=="P"){ cout<<"Player 1 acquires "<<S<<endl<<"Player 2 acquires "<<P<<endl<<"Player 1 wins "; }} if (Player1=="S"){ if (Player2=="R"){ cout<<"Player 1 acquires "<<S<<endl<<"Player 2 acquires "<<R<<endl<<"Player 2 wins "; }} if (Player1==Player2){ cout<<"It's a tie!. Try again";} else cout<<"Something is wrong. Try again";