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:
I would recommend multi-character character constants to achieve this in a succinct manner:
switch ((play1 << 8) + play2) { case 'RP': printf ("Paper wins!"); break; case 'RS': printf ("Rock wins!"); break; case 'RR': printf ("Draw!"); break; }