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

这是一个简单的编程问题,要求根据两个玩家在石头剪子布游戏中的选择来判断胜负。输入包含两行,每行分别代表两个玩家的选择,输出则根据游戏规则决定是胜利、失败还是平局。


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

Time Limit: 1000MS Memory Limit: 65536KB



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


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

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

Example Input
Rock
Scissors

Example Output
Win
Hint
 

Author

lin







参考代码



#include<stdio.h>
#include<string.h>
int main()
{
    char a[100];
    char b[100];
    gets(a);
    gets(b);
    if (strcmp(a, "Rock") == 0 && strcmp(b, "Rock") == 0)
        printf("Equal\n");
    if (strcmp(a, "Rock") == 0 && strcmp(b, "Scissors") == 0)
        printf("Win\n");
    if (strcmp(a, "Rock") == 0 && strcmp(b, "Cloth") == 0)
        printf("Lose\n");
    if (strcmp(a, "Scissors") == 0 && strcmp(b, "Scissors") == 0)
        printf("Equal\n");
    if (strcmp(a, "Scissors") == 0 && strcmp(b, "Rock") == 0)
        printf("Lose\n");
    if (strcmp(a, "Scissors") == 0 && strcmp(b, "Cloth") == 0)
        printf("Win\n");
    if (strcmp(a, "Cloth") == 0 && strcmp(b, "Cloth") == 0)
        printf("Equal\n");
    if (strcmp(a, "Cloth") == 0 && strcmp(b, "Rock") == 0)
        printf("Win\n");
    if (strcmp(a, "Cloth") == 0 && strcmp(b, "Scissors") == 0)
        printf("Lose\n");
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值