0
点赞
收藏
分享

微信扫一扫

K - 小鑫の日常系列故事(二)——石头剪子布

兽怪海北 2022-02-19 阅读 47
c语言

Description

小鑫在上幼儿园的时候,喜欢跟小伙伴健健玩石头剪子布的游戏 ,你能帮他们判断谁胜谁负么?
 

Input

 输入有两行,每一行都有可能为“Rock”(石头),“Scissors”(剪子),”Cloth”(布)。第一行为小鑫的选择,第二行为健健的选择。

Output

 输出有一行,如果小鑫赢了输出“Win”,输了输出“Lose”,平局输出“Equal”。(输出不包括引号)

Sample

Input 

Rock
Scissors

Output 

Win

Hint

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){
    char x[10];
    char y[10];
    scanf("%s %s", &x, &y);
    if(strcmp(x, y) == 0){
        printf("Equal\n");
    }
    else if(strcmp(x, "Rock") == 0){
        if(strcmp(y, "Scissors") == 0){
            printf("Win\n");
        }
        else if(strcmp(y, "Cloth") == 0){
            printf("Lose\n");
        }
    }
    else if(strcmp(x, "Scissors") == 0){
        if(strcmp(y, "Rock") == 0){
            printf("Lose\n");
        }
        else if(strcmp(y, "Cloth") == 0){
            printf("Win\n");
        }
    }
    else if(strcmp(x, "Cloth") == 0){
        if(strcmp(y, "Rock") == 0){
            printf("Win\n");
        }
        else if(strcmp(y, "Scissors") == 0){
            printf("Lose\n");
        }
    }
    return 0;
}

 

举报

相关推荐

0 条评论