急求一个猜谜游戏的C++程序。

# include & ltiostream.h & gt# include & ltstdlib.h & gt# include & lttime.h & gtvoid show(int input){ switch(input){ case 0:cout & lt;& lt(“是石头!”);打破;案例1:cout & lt;& lt(“是剪刀!”);打破;案例2:cout & lt;& lt(“是布!”);打破;默认值:;} void compare(int inputPlay,int input computer){ if(input play = = 0 & amp;& amp输入计算机= = 1 | |输入播放= = 1 & amp;& amp输入计算机= = 2 | |输入播放= = 2 & amp& ampinput computer = = 1){ cout & lt;& lt(" \ n玩家赢了!\ n ");} else if(input play = = input computer){ cout & lt;& lt(" \n平局!\ n ");} else { cout & lt& lt(" \ n计算机赢了!\ n ");} } void main(){ char is goon;int inputPlayint输入计算机;cout & lt& lt(“猜谜游戏\ n”);cout & lt& lt(“游戏描述:\ n \ n”);cout & lt& lt(“石头-0剪刀-1布-2 \ n”);srand(time(NULL));do { cout & lt& lt(" \ n请输入你要猜的拳头:\ n ");CIN & gt;& gt输入播放;if(input play & gt;= 0 & amp& amp输入播放& lt= 2){ cout & lt;& lt(“你”);显示(input play);input computer = rand()% 3;cout & lt& lt(“计算机”);显示(input computer);compare(inputPlay,input computer);} else { cout & lt& lt(“您的输入有错误!\ n ");cout & lt& lt(" \nDescription:石头-0剪刀-1布-2 \ n ");} cout & lt& lt" \ n您想继续吗?(是/否)";CIN & gt;& gtisGoOn}while(isGoOn!='N'||isGoOn!= ' n ');}这段代码应该对你的思维有用,自己加一些函数就行了。