I have an IF-statement that I want to transform into a Switch-statement... But it has 2 variables! Is it possible to do it on C?
It is a rock, paper, scissors game:
(R for rock, P for Paper, S for Scissors)
char play1, play2;
printf("\nPlayer 1 - Enter your Play: ");
scanf ("%c", &play1);
printf("\nPlayer 2 - Enter your Play: ");
scanf (" %c", &play2);
if (play1 == 'R' && play2 == 'P') {
printf ("Paper wins!"); }
else if (play1 == 'R' && play2 == 'S') {
printf ("Rock wins!");}
else if (play1 == 'R' && play2 == 'R) {
printf ("Draw!");}
and I have to do this for the others options, so it would be better to use switch!