Rock-paper-scissors: Difference between revisions

m
→‎{{header|C}}: small style change
m (→‎{{header|C}}: minor comment)
m (→‎{{header|C}}: small style change)
Line 194:
char *names[] = { "Rock", "Paper", "Scissors" };
char str[2];
char *winner[] = { "We tied.", "Meself winned.", "You win." };
 
while (1) {
Line 213:
continue;
}
 
switch ((my_action - user_action + 3) % 3) {
case 0: winner = "We tied."; break;
case 1: winner = "Meself wins."; break;
case 2: winner = "You win."; break;
}
 
printf("You chose %s; I chose %s. %s\n",
names[user_action], names[my_action], winner);
switch ( winner[(my_action - user_action + 3) % 3]) {;
 
user_rec[user_action] ++;
}
}</lang>
Anonymous user