C语言代码:石头剪刀布游戏,间隔K次平局
#include <stdio.h> #include <string.h>
int main() { char s[10]; int k, times = 0; scanf("%d", &k); while (scanf("%s", s) == 1 && strcmp(s, "End")) { times++; if (times % (k + 1) == 0) printf("Bu\n"); else if (strcmp(s, "ChuiZi") == 0) printf("JianDao\n"); else if (strcmp(s, "JianDao") == 0) printf("Bu\n"); else printf("ChuiZi\n"); } return 0; }
原文地址: https://www.cveoy.top/t/topic/oSwv 著作权归作者所有。请勿转载和采集!