#include<stdio.h> #include <stdlib.h> int main(){ printf("剪子包袱锤游戏 "); int isTrue = 1; int userInput; int systemInput; char *types[3] = {"剪子","包袱","锤"}; while (isTrue) { printf("请输入 0剪子 1包袱 2锤: "); scanf("%d", &userInput); systemInput = rand() % 3; printf("系统出:%s ", types[systemInput]); printf("你出:%s ", types[userInput]); if(systemInput == userInput){ printf("平局 "); continue; } if((systemInput-1) == userInput){ printf("你赢 "); continue; }else{ printf("系统赢 "); continue; } } return 0; }