Logo Andy0815的博客

博客

新博客

2023-11-05 18:22:04 By Andy0815
    #include <bits/stdc++.h>
    using namespace std;
    int b;
    int x;
    int y;
    int shengren[7];
    int shengshu=7;
    void shenfen(int a){
        switch(a){
            case 1:
                cout << "必赢家" << endl;
                b=1;
                cout << "你赢了!";
                return 0; 
                break;
            case 2:
                cout << "狼人" << endl;
                b=2;
                break;
            case 3:
                cout << "平民" << endl;
                b=3;
                break;
            case 4:
                cout << "平民" << endl;
                b=4;
                break;
            case 5:
                cout << "守卫" << endl;
                b=5;
                break;
            case 6:
                cout << "平民" << endl;
                b=6;
                break;
            case 7:
                cout << "平民" << endl;
                b=7;
                break;
        }
    }
    int main(){
        cout << "下面开始抽身份";
        for(int i=1;i<=3;i++){
            Sleep(1500);
            cout << ".";
        }
        srand(time(NULL));
        int a=rand()%7+1;
        shenfen(a);
        Sleep(3000);
        while(shengshu==2&&shengren[2]!=-1){
            cout << "天黑请闭眼。";
            cout << "狼人睁眼。";
            bool f=true;
            if(b==2){
                cout << "你要刀谁?(禁止刀自己!)" << endl;
                cin >> x;
                shengren[x]=-1;
            }
            else{
                x=rand()%7+1;
                if(x==1){
                    shengren[2]=-1;
                    shengshu--;
                    x=2;
                }
                else if(x==2){
                    shengren[2]=-1;
                    shengshu--;
                    x=2;
                }
            }
            if(b==5){
                cout << "你要守护谁?" << endl;
                cin >> y;
                if(x==y){
                    shengren[x]=x;
                    f=false;
                }
            }
            cout << "天亮了。" << endl; 
            if(f){
                cout << x << "号被刀了!" << endl;
            }

        }


        return 0;
    }

评论

暂无评论

发表评论

可以用@mike来提到mike这个用户,mike会被高亮显示。如果你真的想打“@”这个字符,请用“@@”。