用c语言编写你和计算机玩猜拳游戏,五局三胜,在屏幕上显示每局情况和最终结果

来源:百度知道 编辑:UC知道 时间:2024/05/26 07:03:04
急用

找到一个,看看合适不。
如下:
enum p_r_s{
paper,rock,scissors,game,help,instructions,quit
}; /*枚举变量,paper表示包袱,rock表示石头,scissors表示剪子*/
#include <stdio.h>
main()
{
enum p_r_s player,machine;
enum p_r_s selection_by_player(),selection_by_machine();
int win,lose,tie;
win=lose=tie=0;
instructions_for_the_player();
while((player=selection_by_player())!=quit)
switch(player){
case paper:
case rock:
case scissors:
machine=selection_by_machine();
if(player==machine){
++tie;
printf("\n a tie");
}
else if(you_won(player,machine)){
++win;
printf("\n you won");
}
else{
++lose;
printf("\n i won");
}
break;
case game:
game_status(win,lose,tie);
break;
case instructions:
instructions_for_the_player();
break;
case help:
help_for_the_player(