-
-
Save mattn/324765 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef enum { GU = 1, CHOKI = 2, PA = 3 } HAND; | |
void judge(HAND handA, HAND handB); | |
int | |
main(void) { | |
judge(GU, GU); | |
judge(GU, CHOKI); | |
judge(GU, PA); | |
puts(""); | |
judge(CHOKI, GU); | |
judge(CHOKI, CHOKI); | |
judge(CHOKI, PA); | |
puts(""); | |
judge(PA, GU); | |
judge(PA, CHOKI); | |
judge(PA, PA); | |
} | |
void | |
judge(HAND myhand, HAND yourhand) { | |
switch ((myhand - yourhand + 3) % 3) { | |
case 0: printf("あいこだよん\n"); break; | |
case 1: printf("あなたの負け\n"); break; | |
case 2: printf("あなたの勝ち\n"); break; | |
default: | |
// http://t2.gstatic.com/images?q=tbn:l-fSJIgOZLWoeM:http://blog-imgs-31-origin.fc2.com/s/m/o/smokie/luck.jpg | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment