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

时间:2019-02-19
本文章向大家介绍小鑫の日常系列故事(二)——石头剪子布,主要包括小鑫の日常系列故事(二)——石头剪子布使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Input

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

Output

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

Sample Input

Rock
Scissors

Sample Output

Win

参考代码

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