问题标题: 剪刀石头布(4.0)

0
0
已解决
李宜和
李宜和
高级启示者
高级启示者

新增了赌牌和看牌。

有bug会得20到50豆

修改意见10豆

#include<bits/stdc++.h>
#include<windows.h>
#include<cstdlib>
#include<time.h>
using namespace std;
int main(){    
    srand((unsigned) time(NULL));
    long long a;
    MessageBox(NULL,"鑫汇工作室出品(李宜和)","鑫汇工作室",MB_OK);
    cout<<endl;
    cout<<"\t\t\t\t鑫汇";
    Sleep(3000);
    system("cls");
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<"\t\t\t\t加载中";
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    system("cls");
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    cout<<".";
    Sleep(300);
    system("cls");
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<"\t\t\t\t完成!";
    system("cls");
    
    
    
    
    MessageBox(NULL,"1=石头,2=剪刀,3=布","规则",MB_OK);
    cout<<"——————————————————————————————"<<endl;
    cout<<"|                                                          |"<<endl;
    cout<<"|   1.游戏(人机)         2.(手动)    3.赌牌  4.看牌      |"<<endl;
    cout<<"|                                                          |"<<endl;
    cout<<"|                                                          |"<<endl;
    cout<<"|                                                          |"<<endl;
    cout<<"——————————————————————————————"<<endl;
    
    
    
    
    int z;
    cin>>z;
    
    if(z==1){
        system("cls");
        long long re=0;
        while(1){
        long long n,m=0,o,h=0;
        o=rand()%3+1;
        cin>>n;
        if(n>3||n<1){
            cout<<"只可输入1,2,3"<<endl; 
            system("cls");
        }else if(n==1||n==2||n==3){
            m+=1;
            cout<<"您现在的得分是"<<re ; 
            Sleep(2000);
                system("cls");
            if(m==1){
                cout<<"你出的是";
                if(n==1){
                    cout<<"石头\t\t\t";
                }else if(n==2){
                    cout<<"剪刀\t\t\t";
                }else if(n==3){
                    cout<<"布\t\t\t";
                }
                cout<<"人机出的是";
                if(o==1){
                    cout<<"石头\t\t\t";
                }else if(o==2){
                    cout<<"剪刀\t\t\t";
                }else if(o==3){
                    cout<<"布\t\t\t";
                }
                Sleep(2000);
            }
            //____________________________________________ 
            if(o==n){
                system("cls");
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                            平局                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                cout<<"不加分。"<<endl; 
                cout<<"您现在的得分是"<<re<<endl; 
            }
//______________________________________________
            if(o==2&&n==3){
                system("cls");
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                            你输了                        |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                cout<<"你输了哦!"<<endl;
                if(re!=0){
                    re--;
                }else if(re==0){
                    re++;
                    re--;
                }
                cout<<"您现在的得分是"<<re<<endl; 
            }
            if(o==3&&n==1){
                system("cls");
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                            你输了                        |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                cout<<"你输了哦!"<<endl;
                if(re!=0){
                    re--;
                }else if(re==0){
                    re++;
                    re--;
                }
                cout<<"您现在的得分是"<<re<<endl; 
               }
            if(o==1&&n==2){
                system("cls");
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                            你输了                        |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                cout<<"你输了哦!"<<endl;
                if(re!=0){
                    re--;
                }else if(re==0){
                    re++;
                    re--;
                }
                cout<<"您现在的得分是"<<re<<endl; 
            }
//_________________________________________________
            if(o==1&&n==3){
                system("cls");
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                            你赢了                        |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                cout<<"你赢了哦!"<<endl;
                re+=1;
                cout<<"您现在的得分是"<<re<<endl; 
            }
            if(o==2&&n==1){
                system("cls");
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                            你赢了                        |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                cout<<"你赢了哦!"<<endl;
                re+=1;
                cout<<"您现在的得分是"<<re<<endl; 
            }
            if(o==3&&n==2){
                system("cls");
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                            你赢了                        |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                cout<<"你赢了哦!"<<endl;
                re+=1;
                cout<<"您现在的得分是"<<re<<endl; 
            }
            if(re==5){
                system("cls");
                cout<<"恭喜闯关成功 ";
                Sleep(2000);
                break;
            }
        //_________________________________________________
            }    
        }
    }
        

    if(z==2){
        system("cls");
        cout<<"输入一两数,按Enter,让另外一个人输入两个数,按Enter。"<<endl;
        cout<<"左边是先输入的,右边是后输入的";
        Sleep(2000);
        system("cls"); 
        while(1){
        long long n,m=0,o,f,g,cv,vb;
        cin>>n>>cv;
        system("cls");
        cin>>o>>vb;
        system("cls");
        
//____________________________________________ 
        if((n*cv)%3==(o*vb)%3){
            system("cls");
            cout<<"——————————————————————————————"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                            平局                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"——————————————————————————————"<<endl;
        }
//______________________________________________
        if((o*vb)%3==2&&(n*cv)%3==3){
            system("cls");
            cout<<"——————————————————————————————"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|           你输了         你赢了                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"——————————————————————————————"<<endl;
        }
        if((o*vb)%3==3&&(n*cv)%3==1){
            system("cls");
            cout<<"——————————————————————————————"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|            你输了         你赢了                         |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"——————————————————————————————"<<endl;
        }
        if((o*vb)%3==1&&(n*cv)%3==2){
            system("cls");
            cout<<"——————————————————————————————"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|          你输了               你赢了                     |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"——————————————————————————————"<<endl;
        }
//_________________________________________________
        if((o*vb)%3==1&&(n*cv)%3==3){
            system("cls");
            cout<<"——————————————————————————————"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|           你赢了                你输了                   |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"——————————————————————————————"<<endl;
        }
        if((o*vb)%3==2&&(n*cv)%3==1){
            system("cls");
            cout<<"——————————————————————————————"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|          你赢了                   你输了                 |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"——————————————————————————————"<<endl;
        }
        if((o*vb)%3==3&&(n*cv)%3==2){
            system("cls");
            cout<<"——————————————————————————————"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|          你赢了                  你输了                  |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"|                                                          |"<<endl;
            cout<<"——————————————————————————————"<<endl;
        }
        //_________________________________________________
        }
    }
    if(z==3){
        system("cls");
        cout<<"欢迎来到赌牌场,你可以猜人机出的什么牌,对了+2分,错了-1分,初始5分";
        Sleep(2000);
           system("cls");
           MessageBox(NULL,"1=石头,2=剪刀,3=布","规则",MB_OK);
           int qwe,tyu,op=5;
        while(1){
            system("cls");
            cout<<"你猜人机出"<<endl;
            cin>>qwe;
            tyu=rand()%3+1;
            cout<<"你猜的是";
               if(qwe==1){
                cout<<"石头\t\t\t";
            }else if(qwe==2){
                cout<<"剪刀\t\t\t";
            }else if(qwe==3){
                cout<<"布\t\t\t";
            }
               cout<<"人机出的是";
               Sleep(2000);
               if(tyu==1){
                   cout<<"石头\t\t\t"<<endl;
            }else if(tyu==2){
                cout<<"剪刀\t\t\t"<<endl;
            }else if(tyu==3){
                cout<<"布\t\t\t"<<endl;
            }
            if(qwe==tyu){
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                         你赢了                           |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                Sleep(2000);
                op+=2;
                cout<<"您现在的得分是"<<op<<endl; 
                Sleep(2000);    
            }else{
                cout<<"——————————————————————————————"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                         你输了                           |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"|                                                          |"<<endl;
                cout<<"——————————————————————————————"<<endl;
                Sleep(2000);
                op--;
                cout<<"您现在的得分是"<<op<<endl; 
                Sleep(2000);
            }
            if(op>=10){
                system("cls");
                cout<<"恭喜闯关成功 ";
                Sleep(2000);
                break;
            }
            if(op<=0){
                cout<<"闯关失败。。。";    
                Sleep(2000);
                break;            
            }
        }    
    }
    if(z==4){
        system("cls");
        cout<<"请记住顺序哦。"<<endl;
        Sleep(2000);
        int lopk,zxcv,vfrt,wsxd,nhyg,ftgb,jihg,asec,vtav,niwn,a1,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10;
        cout<<"请选择难度。1.萌新 2.老玩家  3.大神  4.灭世";
        cin>>a1;
        if(a1==1){
            lopk=rand()%9+1;
            zxcv=rand()%9+1;
            vfrt=rand()%9+1;
            wsxd=rand()%9+1;
            nhyg=rand()%9+1;
            ftgb=rand()%9+1;
            jihg=rand()%9+1;
            asec=rand()%9+1;
            vtav=rand()%9+1;
            niwn=rand()%9+1;
            system("cls");
            cout<<lopk;
            Sleep(2000);
            system("cls");
            cout<<zxcv;
            Sleep(2000);
            system("cls");
            cout<<vfrt;
            Sleep(2000);
            system("cls");
            cout<<wsxd;
            Sleep(2000);
            system("cls");
            cout<<nhyg;
            Sleep(2000);
            system("cls");
            cout<<ftgb;
            Sleep(2000);
            system("cls");
            cout<<jihg;
            Sleep(2000);
            system("cls");
            cout<<asec;
            Sleep(2000);
            system("cls");
            cout<<vtav;
            Sleep(2000);
            system("cls");
            cout<<niwn;
            Sleep(2000);
            system("cls");
            cout<<"下面开始复述吧!\n";
            cin>>b1>>b2>>b3>>b4>>b5>>b6>>b7>>b8>>b9>>b10; 
            if(b1==lopk&&b2==zxcv&&b3==vfrt&&b4==wsxd&&b5==nhyg&&b6==ftgb&&b7==jihg&&b8==asec&&b9==vtav&&b10==niwn){
                cout<<"\n闯关成功。!!";
                Sleep(2000);
            }else{
                cout<<"\n闯关失败。。。";
                Sleep(2000);
            }
        }else if(a1==2){
            int nm[100],mn[100],lyh=0;
            for(int i=1;i<=10;i++){
                nm[i]=rand()%109+1;
            }
            for(int i=1;i<=10;i++){
                system("cls");
                cout<<nm[i];
                Sleep(1500);
            }
            system("cls");
            cout<<"下面开始复述吧!\n";
            for(int i=1;i<=10;i++){
                cin>>mn[i];
                if(mn[i]==nm[i]){
                    lyh+=1;
                }
            }
            if(lyh==10){
                cout<<"\n闯关成功。!!";
                Sleep(2000);
            }else{
                cout<<"\n闯关失败。。。";
                Sleep(2000);
            }
        }else if(a1==3){
            int xy[100],yx[100],lyh1=0;
            for(int i=1;i<=10;i++){
                xy[i]=rand()%1009+1;
            }
            for(int i=1;i<=10;i++){
                system("cls");
                cout<<xy[i];
                Sleep(1000);
            }
            system("cls");
            cout<<"下面开始复述吧!\n";
            for(int i=1;i<=10;i++){
                cin>>yx[i];
                if(yx[i]==xy[i]){
                    lyh1+=1;
                }
            }
            if(lyh1==10){
                cout<<"\n闯关成功。!!";
                Sleep(2000);
            }else{
                cout<<"\n闯关失败。。。";
                Sleep(2000);
            }
        }else if(a1==4){
            int ab[100],ba[100],lyh2=0;
            for(int i=1;i<=10;i++){
                ab[i]=rand()%10009+1;
            }
            for(int i=1;i<=10;i++){
                system("cls");
                cout<<ab[i];
                Sleep(500);
            }
            system("cls");
            cout<<"下面开始复述吧!\n";
            for(int i=1;i<=10;i++){
                cin>>ba[i];
                if(ba[i]==ab[i]){
                    lyh2+=1;
                }
            }
            if(lyh2==10){
                cout<<"\n闯关成功。!!";
                Sleep(2000);
            }else{
                cout<<"\n闯关失败。。。";
                Sleep(2000);
            }
        }
    } 
    system("cls");
    cout<<"你对此游戏的评价:1.1星,2.2星,3.3星,4.4星,5.5星"<<endl;
    int qw;
    while(1){
        cin>>qw;
        system("cls");
        if(qw>5||qw<=0){
            cout<<"输入失败";
            Sleep(1000);
            system("cls");
        }else{
            cout<<"谢谢你的评价";
            Sleep(1000);
            break;
        }
    }
    system("cls");
    cout<<"如果您能发现bug/问题,请发在贴上,重要的给10~50豆";
    Sleep(3000);
    return 0;
}
 

李宜和在2021-06-30 08:52:25追加了内容

ding


0
已采纳
朱小川
朱小川
缔造者
缔造者

为什么赌牌一局结束后整个代码就停止运作了,建议循环玩

 

朱小川在2021-06-30 16:18:58追加了内容

那个(手动)也没啥意思,建议删除

朱小川在2021-06-30 16:21:17追加了内容

建议加入一个退出功能,不然这个模式不想玩了,想退出,结果得重新来玩,那就太麻烦

0
0
朱小川
朱小川
缔造者
缔造者

看牌模式当输入失败之后,那个“输入失败”就一直在闪,也无法输入了,成了一个死循环

朱小川在2021-06-30 16:21:49追加了内容

其他没什么了

我要回答