为什么这段代码编译错误
  • 板块灌水区
  • 楼主GoodLuckCat
  • 当前回复6
  • 已保存回复6
  • 发布时间2023/9/30 08:41
  • 上次更新2023/11/2 17:03:32
查看原帖
为什么这段代码编译错误
916579
GoodLuckCat楼主2023/9/30 08:41

rt

#include<bits/stdc++.h>
using namespace std;
short dice[6],dice1,dice2,dice3,dice4,dice5,dice6;
int sixdice,what,max;
bool one()
{
	if(sixdice==123456)return 0;
	if(sixdice==111114)return 0;
	if(sixdice==222224)return 0;
	if(sixdice==333334)return 0;
	if(sixdice==455555)return 0;
	if(sixdice==466666)return 0;
	return dice4==1;
}
bool two(){return dice4==2;}
bool three(){return dice4==3;}
bool four(){return dice1==4||dice2==4||dice3==4||dice5==4||dice6==4;}
bool five(){return sixdice==123456;}
bool six()
{
	if(dice4==4)return 1;
	if(dice1==5||dice1==6)return 1;
	if(dice2==5||dice2==6)return 1;
	if(dice3==5||dice3==6)return 1;
	if(dice4==5||dice4==6)return 1;
	if(dice5==5||dice5==6)return 1;
	if(dice6==5||dice6==6)return 1;
	return 0;
}
void _six_()
{
	switch(sixdice)
	{
		case 124444:{cout<<"四红带三";break;}
		case 134444:{cout<<"四红带四";break;}
		case 144445:{cout<<"四红带六";break;}
		case 144446:{cout<<"四红带七";break;}
		case 224444:{cout<<"四红带四";break;}
		case 234444:{cout<<"四红带五";break;}
		case 244445:{cout<<"四红带七";break;}
		case 244446:{cout<<"四红带八";break;}
		case 334444:{cout<<"四红带六";break;}
		case 344445:{cout<<"四红带八";break;}
		case 344446:{cout<<"四红带九";break;}
		case 444455:{cout<<"四红带十";break;}
		case 444456:{cout<<"四红带十一";break;}
		case 444466:{cout<<"四红带十二";break;}
		case 111112:{cout<<"五子带二";break;}
		case 111113:{cout<<"五子带三";break;}
		case 111114:{cout<<"五子带四";break;}
		case 111115:{cout<<"五子带五";break;}
		case 111116:{cout<<"五子带六";break;}
		case 122222:{cout<<"五子带一";break;}
		case 222223:{cout<<"五子带三";break;}
		case 222224:{cout<<"五子带四";break;}
		case 222225:{cout<<"五子带五";break;}
		case 222226:{cout<<"五子带六";break;}
		case 133333:{cout<<"五子带一";break;}
		case 233333:{cout<<"五子带二";break;}
		case 333334:{cout<<"五子带四";break;}
		case 333335:{cout<<"五子带五";break;}
		case 333336:{cout<<"五子带六";break;}
		case 155555:{cout<<"五子带一";break;}
		case 255555:{cout<<"五子带二";break;}
		case 355555:{cout<<"五子带三";break;}
		case 455555:{cout<<"五子带四";break;}
		case 555556:{cout<<"五子带六";break;}
		case 166666:{cout<<"五子带一";break;}
		case 266666:{cout<<"五子带二";break;}
		case 366666:{cout<<"五子带三";break;}
		case 466666:{cout<<"五子带四";break;}
		case 566666:{cout<<"五子带五";break;}
		case 144444:{cout<<"五红带一";break;}
		case 244444:{cout<<"五红带二";break;}
		case 344444:{cout<<"五红带三";break;}
		case 444445:{cout<<"五红带五";break;}
		case 444446:{cout<<"五红带六";break;}
		case 111111:{cout<<"遍地锦";break;}
		case 444444:{cout<<"六博红";break;}
		case 114444:{cout<<"状元插金花";break;}
		default:{cout<<"六博黑";break;}
	}
	cout<<endl;
}
void play()
{
	dice1=dice2=dice3=dice4=dice5=dice6=sixdice=0;
	for(short i=0;i<6;++i)
	{
		dice[i]=rand()%6+1;
		cout<<dice[i]<<' ';
		int sleeptime=500000000;
		//while(sleeptime--);
	}
	sort(dice,dice+6);
	for(short i=0;i<6;++i)
	{
		if(dice[i]==1)++dice1;
		if(dice[i]==2)++dice2;
		if(dice[i]==3)++dice3;
		if(dice[i]==4)++dice4;
		if(dice[i]==5)++dice5;
		if(dice[i]==6)++dice6;
	}
	for(short i=0;i<6;++i)sixdice=sixdice*10+dice[i];
	if(six())_six_();
	else
	{
		what=10000*one()+1000*two()+100*three()+10*four()+five();
		if(what==10000)cout<<"一秀";
		if(what==1000)cout<<"二举";
		if(what==100)cout<<"三红";
		if(what==10)cout<<"四进";
		if(what==1)cout<<"对堂";
		if(what==0)cout<<"没有";
		if(what==10010)cout<<"四进带一秀";
		if(what==1010)cout<<"四进带二举";
		cout<<endl;
	}
}
int main()
{
	srand(time(0));
	cout<<"请输入博饼的次数:";
	cin>>max;
    for(int now=1;now<=max;++now)play();
}
2023/9/30 08:41
加载中...