C剪子包袱锤

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

 

posted @ 2020-10-07 21:11  夏秋初  阅读(255)  评论(0编辑  收藏  举报