熬夜没事干,打了个简易斗地主(指发牌
  • 板块灌水区
  • 楼主aaaaaaaawsl
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/2/12 01:00
  • 上次更新2023/10/28 08:49:43
查看原帖
熬夜没事干,打了个简易斗地主(指发牌
307940
aaaaaaaawsl楼主2022/2/12 01:00

然后和qq群里的人玩了起来

(

#include<bits/stdc++.h>

using namespace std;

int num[20];
int x;
int d;
int peo[5][16];

int main(){
	srand(time(0));
	int tot = 0;
	for(int i = 1; i <= 3; ++ i){
		while(tot != 18){
			int a = rand() % 15 + 1;
			if(a == 14 && x == 0){
				peo[i][a] ++ ;
				x = 1;
				tot ++;
			}
			else if(a == 15 && d == 0){
				peo[i][a] ++ ;
				d = 1;
				tot ++;
			}
			else if( a < 14 && peo[i][a] < 4 && num[a] < 4){
				peo[i][a] ++;
				num[a] ++;
				tot ++;
			}
		}
		tot = 0;
	}
	for(int i = 1; i <= 3; ++ i){
		cout << "第" << i << "位: ";
		for(int j = 1; j <= 15; ++ j){
			if(peo[i][j]){
				if(j == 11)
				cout << peo[i][j] << "个J ";
				else if(j == 12)
				cout << peo[i][j] << "个Q ";
				else if(j == 13)
				cout << peo[i][j] << "个K ";
				else if(j == 14)
				cout << "小王 ";
				else if(j == 15)
				cout << "大王 ";
				else
				cout << peo[i][j] << "个"<< j << ' ';
			}
		}
		cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
	}
	cout << rand() % 3 + 1;
	int a;
	for(int i = 1; i <= 13; ++ i){
			num[i] = 4;
	}
	num[14] = 1;
	num[15] = 1;
	while(1){
		cout  << endl << "输入出了的牌:"; 
		cin >> a;
		num[a] --;
		for(int i = 1; i <= 15; ++ i){
			cout << "现在有:" <<num[i]<<"张"<< i  << "  "; 
		}
		cout << endl;
	}
	return 0;
}
2022/2/12 01:00
加载中...