C++狼人杀源代码(可复制)

话不多说,上狠货。                                                                                                                           #include <iostream>
#include <cstdlib>
#include <Windows.h>
#include <conio.h>
using namespace std;
void brc()
{
    system("cls");
    int jy=1;
    int sy=3; 
    srand((int)time(0));
    int n=rand()%15+1;
    cout<<"                                你是"<<n<<"号"<<endl;
    cout<<"                               正在分配身份"<<endl;
    Sleep(1500);
    int m[20];
    for(int i=1;i<=15;i++)
        m[i]=1;
    int s[20]={0};
    int yy[20]={0};
    int l=0,w=0,j=0,p=0;
    for(int i=1;i<=15;i++)
    {
        do
        {
            int a=rand()%4+1;
            if(a==1&&l<2)
            {
             
                l++;
                s[i]=1;
            }
            else if(a==2&&w<2)
            {
                w++;
                s[i]=2;
            }
            else if(a==4&&p<1)
            {
                p++;
                s[i]=4;
            }
            else if(a==3&&j<10)
            {
                j++;
                s[i]=3;
            }
        }
        while(s[i]==0);
    }
    if(s[n]==1)
        cout<<"                               你是>>杀手<<"<<endl;
    else if(s[n]==2)
        cout<<"                               你是>>预言家<<"<<endl;
    else if(s[n]==3)
        cout<<"                               你是>>平民<<"<<endl;
    else
        cout<<"                               你是>>女巫<<"<<endl;
    cout<<"                             游戏将在5秒后开始"<<endl; 
    Sleep(5000);
    int c=15;
    int f=0,flag=0;
    int day=1;
    int lr;
    int tp[20]={0};
    do
    {
        lr=0;
        system("cls");
        cout<<"                                 第"<<day<<"晚开始"<<endl;
        int x;
        for(int i=1;i<=15;i++) 
        {
            if(i==n&&m[n]==1)
            {
                if(s[n]==1)
                {
                    cout<<"                                 你是杀手"<<endl;
                    for(int j=1;j<=15;j++)
                        if(m[j]==1&&s[j]!=1)
                            cout<<j<<" ";
                    cout<<endl;
                    cout<<"                                 你选择杀掉"<<endl; 
                    int a;
                    cin>>a;
                    m[a]=0;
                    cout<<endl;
                    cout<<"                                 杀手杀了"<<a<<"号"; 
                    if(s[a]==1)
                        cout<<"(杀手)"<<endl;
                    else if(s[a]==2)
                        cout<<"(预言家)"<<endl;
                    else if(s[a]==3)
                        cout<<"(平民)"<<endl;
                    else
                        cout<<"(女巫)"<<endl;
                    c--;
                }    
                else if(s[n]==2)
                {
                    cout<<"                                 你是预言家"<<endl;
                    cout<<"                               ";
                    for(int j=1;j<=15;j+

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值