网上有关“c++模拟发牌程序”话题很是火热,小编也是针对c++模拟发牌程序寻找了一些与之相关的一些信息进行分析,如果能碰巧解决你现在面临的问题,希望能够帮助到您。
您好:手机麻将有挂是真的吗这款游戏可以开挂,确实是有挂的,咨询加微信【】很多玩家在这款游戏中打牌都会发现很多用户的牌特别好,总是好牌,而且好像能看到其他人的牌一样。所以很多小伙伴就怀疑这款游戏是不是有挂,实际上这款游戏确实是有挂的
1.手机麻将有挂是真的吗这款游戏可以开挂,确实是有挂的,通过添加客服微信
2.咨询软件加微信【】在"设置DD功能DD微信手麻工具"里.点击"开启".
3.打开工具.在"设置DD新消息提醒"里.前两个选项"设置"和"连接软件"均勾选"开启"(好多人就是这一步忘记做了)
4.打开某一个微信组.点击右上角.往下拉."消息免打扰"选项.勾选"关闭"(也就是要把"群消息的提示保持在开启"的状态.这样才能触系统发底层接口)
#ifndef card_h
#define card_h
#include "unit.h" //这个里面可以写描述牌的类,包括每一张牌属性
//和函数,属性包括牌面、花色,函数可以有显示本张拍信息show()
//,还应该有获得各个属性的get或set函数
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
class A_Set_Card //描述一副牌
{
private:
unit *top; //表头
int n; //当前这副牌中有多少张牌
public:
card(); //构造函数
~card(); //析构,这个别忘了
unit* outputone(); //随机派一张牌
void creat(); //产生不含大小王的一副牌
};
A_Set_Card::A_Set_Card()
{
top = NULL;
n = 0;
}
A_Set_Card::~A_Set_Card() //析构函数
{
unit *tem = top; //从表头开始
top = NULL;
while (tem) //如果null != tem
{
unit *pp = tem; //用指针pp接住tem所指向的单元
tem = tem->nextp; //tem后移
delete pp; //析构掉刚才tem所指的单元
}
n = 0; //这幅牌中牌数归零
cout<<"。。。洗完牌。。。"<<endl;
}
void A_Set_Card::create()
{
for(int j=1; j<5; j++) //j的取值{1、2、3、4}代表四种花色
{
for(int i=1; i<14; i++) //i的取值{1...13}代表A到K,13种牌面,共13*4 = 52张
{
unit *newp = new unit; //生成一张牌
n++;
newp->inputnum(i); //inputnum()函数用来设置牌面,具体到unit.h里描述单张牌的类中去写
if(j == 1)
{
newp->inputname("黑桃"); //inputname()函数用来设置花色
}
else if (j == 2)
{
newp->inputname("红桃");
}
else if (j == 3)
{
newp->inputname("梅花");
}
else
{
newp->inputname("方块");
}
if (top == NULL) //第一张
{
top = newp;
top->nextp = NULL;
}
else //非第一张
{
unit *tem = top;
top = newp;
top->nextp = tem;
}
}
}
}
unit* A_Set_Card::outputone()
{
unit *tem = top; //接过头
srand(time(0)); //设置随机种子
int nn = rand()%n; //在这副牌中剩余的所有牌里随机选一张
if (nn == 0)//恰好是第一张
{
if(tem==NULL)//若空
{
cout<<"空链表"<<endl;
return NULL;
}
top = tem->nextp;
n--;
return tem;
}
else//非第一张
{
for (int i=0; i<nn-1; i++) //tem往下移nn次
{
tem = tem->nextp;
}
if(tem==NULL)//若空
{
cout<<"空链表"<<endl;
return NULL;
}
else
{
unit *pp = tem->nextp;//删除这一张
tem->nextp = tem->nextp->nextp;
n--;//记住牌数自减
return pp;
}
}
}
void A_Set_Card::sort()
{}
#endif
C语言编程——发牌洗牌模拟,求帮助
#include?"stdio.h"
#include?"time.h"
#define?poke_NUM?(52)
int?poke[poke_NUM];
//黑?A-?K红?A?-?K?梅?A-K?方?A-K
#define?TYPE(p)?(p?/?13)
#define?VALUE(p)?(p?%?13)
#define?SWAP(a,?b)?{int?tmp?=?a;?a?=?b;?b?=?tmp;}
void?init_poke()?{
int?i;
for?(i?=?0;?i?<?poke_NUM;?i++)?
poke[i]?=?i;
}
void?sort_poke(int*?d,?int?n)?{
int?i,?j;
for?(i?=?0;?i?<?n-1;?i++)?{
int?typeA?=?TYPE(d[i]);
int?valueA?=?VALUE(d[i]);
for?(j?=?i;?j?<?n;?j++)?{
int?typeB?=?TYPE(d[j]);
int?valueB?=?VALUE(d[j]);
if?(typeA?>?typeB?||
(typeA?==?typeB?&&?valueA?>?valueB))?{
SWAP(d[i],?d[j]);
typeA?=?typeB;
valueA?=?valueB;
}
}
}
}
void?rand_poke()?{
int?i;
srand(time(NULL));
i?=?poke_NUM;
while?(i--?>?0)?{
int?a,?b;
a?=?rand()?%?poke_NUM;
do?{
b?=?rand()?%?poke_NUM;
}?while?(b?==?a);
SWAP(poke[a],?poke[b]);
}
for?(i?=?0;?i?<?4;?i++)?{
sort_poke(&poke[i*13],?13);
}
}
void?print_poke()?{
int?i;
char?name[4][2]?=?{"A",?"B",?"C",?"D"};
char?typename[4][4]?=?{"黑",?"红",?"梅",?"方"};
char?valuename[5][4]?=?{"A",?"10",?"J",?"Q",?"K"};
int?lasttype?=?-1;
for?(i?=?0;?i?<?poke_NUM;?i++)?{
int?type?=?TYPE(poke[i]);
int?value?=?VALUE(poke[i]);
if?(i?%?13?==?0)?{
printf("\nPlayer?%s:",?name[i/13]);
}
if?(type?!=?lasttype)?{
printf("\n%s?-?",?typename[type]);
lasttype?=?type;
}
if?(value?==?0)?printf("%s?",?valuename[0]);
else?if?(value?<=?8)?printf("%c?",?'1'?+?value);
else?printf("%s?",?valuename[value?-?8]);
}
}
int?main()?{
init_poke();
rand_poke();
print_poke();
return?0;
}
实现了2副牌的发牌,和每个人的牌和底牌
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
struct CARD //牌
{
char suit[10];
char face[10];
};
enum { posA, posB, posC, posD};//定义好每个人的位置
struct Postion
{
struct CARD getcard[25];//每人获得的牌
};
struct Postion postion[4];//分配四个位置
struct CARD leftCard[8]; //底牌
struct CARD card[54]; //54张牌
char *suit[]={"Spades","Hearts","Clubs","Diamonds"};
char *face[] = {"A","2","3","4","5","6","7","8","9",
"10","jack","Queen","King"};
void Shuffle(struct CARD *wCard)
{
int i,j;
struct CARD temp;
for (i=0; i<54; i++)
{
j=rand()%54;
temp=wCard[i];
wCard[i]=wCard[j];
wCard[j]=temp;
}
}
void Deal(struct CARD *wCard)
{
int i,aidx=0,bidx=0,cidx=0,didx=0;
Shuffle(card);//将牌打乱
// 第一次发完50张后,A,B多一张,所以下面第二次让C,D排在前面,两次发完刚好各40张 */
for (i=0; i<50; i++)//发牌数
{
// printf("%10s %5s\n", wCard[i].suit, wCard[i].face);
if(i%4==0)
postion[posA].getcard[aidx++]=wCard[i];
else if(i%4==1)
postion[posB].getcard[bidx++]=wCard[i];
else if(i%4==2)
postion[posC].getcard[cidx++]=wCard[i];
else if(i%4==3)
postion[posD].getcard[didx++]=wCard[i];
}
leftCard[0]=wCard[i++];
leftCard[1]=wCard[i++];
leftCard[2]=wCard[i++];
leftCard[3]=wCard[i++];
Shuffle(card);//再次将牌打乱
for (i=0; i<50; i++)//发牌数
{
// printf("%10s %5s\n", wCard[i].suit, wCard[i].face);
if(i%4==0)
postion[posC].getcard[cidx++]=wCard[i];
else if(i%4==1)
postion[posD].getcard[didx++]=wCard[i];
else if(i%4==2)
postion[posA].getcard[aidx++]=wCard[i];
else if(i%4==3)
postion[posB].getcard[bidx++]=wCard[i];
}
leftCard[4]=wCard[i++];
leftCard[5]=wCard[i++];
leftCard[6]=wCard[i++];
leftCard[7]=wCard[i++];
}
void FillCard(struct CARD wCard[],char *wSuit[], char *wFace[])
{
int i;
for (i=0; i<52; i++)
{
strcpy(wCard[i].suit, wSuit[i/13]);
strcpy(wCard[i].face, wFace[i%13]);
}
// wCard[53].face="Big"; //大小王
strcpy(wCard[52].suit, "Small");
strcpy(wCard[52].face, "ghost");
strcpy(wCard[53].suit, "Big");
strcpy(wCard[53].face, "ghost");
}
void print(char ch)//输出牌
{
int i;
switch(ch)
{
case 'A': for(i=0; i<25; i++)
{
printf("%10s %5s\n", postion[posA].getcard[i].suit, postion[posA].getcard[i].face);
}
break;
case 'B': for(i=0; i<25; i++)
{
printf("%10s %5s\n", postion[posB].getcard[i].suit, postion[posB].getcard[i].face);
}
break;
case 'C': for(i=0; i<25; i++)
{
printf("%10s %5s\n", postion[posC].getcard[i].suit, postion[posC].getcard[i].face);
}
break;
case 'D': for(i=0; i<25; i++)
{
printf("%10s %5s\n", postion[posD].getcard[i].suit, postion[posD].getcard[i].face);
}
break;
}
}
void outputLeftCard()//输出底牌
{
int i;
for(i=0; i<8; i++)
printf("%10s %5s\n", leftCard[i].suit, leftCard[i].face);
}
int main()
{
char pos;
srand(time(NULL));
FillCard(card,suit,face);
//Shuffle(card);
Deal(card);
printf("Please choose your position(A、B、C、D):");
scanf("%c", &pos);
print(pos);//输出你所在位置的牌
if(pos !='A')
{
printf("A:\n");
print('A');
}
if(pos !='B')
{
printf("B:\n");
print('B');
}
if(pos !='C')
{
printf("C:\n");
print('C');
}
if(pos !='D')
{
printf("D:\n");
print('D');
}
printf("底牌为:\n");
outputLeftCard();//输出底牌
return 0;
}
关于“c++模拟发牌程序”这个话题的介绍,今天小编就给大家分享完了,如果对你有所帮助请保持对本站的关注!