C++剪刀石头布
# include & lttime.h & gt
# include & ltstdlib.h & gt
# include & ltconio.h & gt
int main1(int n1)
{
srand((无符号)time(0));
n 1 = rand()% 3;
返回n 1;
}
int main()
{
int cho,good,temp,win=0,lose=0,tie = 0;
char a;
cout & lt& lt"11111111111111111111111111111111111111"
cout & lt& lt"欢迎来到石头、剪刀、布的世界!"& lt& ltendl & lt& lt"按任意键开始游戏..."< & ltendl
cout & lt& lt"11111111111111111111111111111111111111"
getch();
while(1){
cout & lt& lt"/////////新游戏/////////"
cout & lt& lt"1.石头”
cout & lt& lt"2.拿出剪刀”
cout & lt& lt"3.布料交付”
cout & lt& lt“* * * * * * * * * * * * * * * * * * * * * * * * * * * * *”& lt;& ltendl
cout & lt& lt”请选择”;
CIN & gt;& gtcho//用户输入任意数字1-3。
good = main 1(temp);
开关(良好)
{
案例0:
cout & lt& lt”对方有剪刀\ n”;
if(CHO = = 1)cout & lt;& lt“你赢了”
if(CHO = = 2)cout & lt;& lt"甚至"
if(CHO = = 3)cout & lt;& lt“你输了”
cout & lt& lt"情况:"
打破;
案例1:
cout & lt& lt”对方扔石头\ n”;
if(CHO = = 3)cout & lt;& lt“你赢了”
if(CHO = = 1)cout & lt;& lt"甚至"
if(CHO = = 2)cout & lt;& lt“你输了”
cout & lt& lt"情况:"
打破;
案例二:
cout & lt& lt”另一边没布了\ n”;
if(CHO = = 2)cout & lt;& lt“你赢了”
if(CHO = = 3)cout & lt;& lt"甚至"
if(CHO = = 1)cout & lt;& lt“你输了”
cout & lt& lt"情况:"
打破;
}}
返回0;
}