题目描述:
大家小时候都玩过石头剪子布的游戏吧,出石头的人赢出剪子的人,
出剪子的人赢出布的人,出布的人赢出石头的人,如果两个人出的一样,则打平。
飞燕姐姐和婷婷玩石头剪子布的游戏,请你写一个程序判断一下谁赢了
输入:
石头用stone表示,剪子用scissors表示,布用cloth表示
飞燕姐姐和婷婷出的用空格隔开
以EOF结束
输出:
飞燕姐姐赢了则输出yzfy wins!
婷婷赢了则输出wtthappy wins!
打平则输出The game ends in a draw.
谁出错了就判另一方赢,大家都出错了就和
样例输入:
stone cloth
stone stone
stone scissors
scissor stone
stome scissor
样例输出:
wtthappy wins!
The game ends in a draw.
yzfy wins!
wtthappy wins!
The game ends in a draw.
其它:
题目提供:wtthappy
<script type=text/javascript>
</script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript> </script>
大家小时候都玩过石头剪子布的游戏吧,出石头的人赢出剪子的人,
出剪子的人赢出布的人,出布的人赢出石头的人,如果两个人出的一样,则打平。
飞燕姐姐和婷婷玩石头剪子布的游戏,请你写一个程序判断一下谁赢了
输入:
石头用stone表示,剪子用scissors表示,布用cloth表示
飞燕姐姐和婷婷出的用空格隔开
以EOF结束
输出:
飞燕姐姐赢了则输出yzfy wins!
婷婷赢了则输出wtthappy wins!
打平则输出The game ends in a draw.
谁出错了就判另一方赢,大家都出错了就和
样例输入:
stone cloth
stone stone
stone scissors
scissor stone
stome scissor
样例输出:
wtthappy wins!
The game ends in a draw.
yzfy wins!
wtthappy wins!
The game ends in a draw.
其它:
题目提供:wtthappy
- #define PB_ID ct10_3
- #define CP_GCC
- #include<stdio.h>
- #include<string.h>
- #define MAX 10
- int isRight(char* str)
- {
- if(!strcmp(str,"stone") || !strcmp(str,"scissors") || !strcmp(str,"cloth"))
- return 1;
- else
- return 0;
- }
- int main()
- {
- char yzfy[MAX],wtthappy[MAX];
- while(scanf("%s%s",yzfy,wtthappy)!=EOF){
- if((!isRight(yzfy) && !isRight(wtthappy)) || !strcmp(yzfy,wtthappy)){
- printf("The game ends in a draw./n");
- continue;
- }
- if(!isRight(yzfy) && isRight(wtthappy)){
- printf("wtthappy wins!/n");
- continue;
- }
- if( isRight(yzfy) && !isRight(wtthappy)){
- printf("yzfy wins!/n");
- continue;
- }
- if( !strcmp(yzfy,"stone"))
- if(!strcmp(wtthappy,"cloth"))
- printf("wtthappy wins!/n");
- else
- printf("yzfy wins!/n");
- if( !strcmp(yzfy,"cloth"))
- if(!strcmp(wtthappy,"scissors"))
- printf("wtthappy wins!/n");
- else
- printf("yzfy wins!/n");
- if( !strcmp(yzfy,"scissors"))
- if(!strcmp(wtthappy,"stone"))
- printf("wtthappy wins!/n");
- else
- printf("yzfy wins!/n");
- }
- return 0;
- }