纸牌游戏:十点半
不能再要牌。,不能再要牌,J,Q,K算为半点。,点大者胜;,则点数最小者赢。
(二)任何一张ints*/
Build_Show(HuaSe, DianShu,ShuZi); /*Establish the card and show it*/
do{
Wash_Card(); /*Wash cards*/
a: puts("\nPlease input the number of the player:");
scanf("%d", &n);
switch(n)
{
case 1:puts("You play with the computer!");
break;
case 2:puts("You two play!");
break;
case 3:puts("You three play!");
break;
case 4:puts("You four play!");
break;
case 5:puts("You five play!");
break;
case 6:puts("You six play!");
break;
case 7:puts("You seven play!");
break;
case 8:puts("You eight play!");
break;
default:puts("The number of the players is too large!");
goto a;
}
Get_Card(n); /*Hand out the cards and give the result*/
do{
puts("\nDo you want to play again?1 represents yes and 0 no:");
scanf("%d", &flag);
}while(flag != 1 && flag != 0);
} while(flag == 1);
}
void Build_Show(int HuaSe[], float DianShu[], char ShuZi[])
{
int i, j;
for(i=0; i<4; i++) /*Establish a pair of cards*/
for(j=0; j<13; j++)
{
Card[j+13*i].color = HuaSe[i];
Card[j+13*i].number = ShuZi[j];
Card[j+13*i].num = DianShu[j];
}
puts("This is a new pair of cards:");
/*Show the whole pair to the players to check*/
for(i=0,j=0; i<52; i++,j++)
{
if(!(j%13))
printf("\n");
printf("%c%c", Card[i].color , Card[i].number);
}
}
void Wash_Card(void)
{
int i,rand1,rand2,hua;
char dian;
float shu;
for(i=0; i<1; i++)
{
rand1=random(52); /*Get a card by random,and put the cards into mess*/
rand2=random(52);
if(rand1!=rand2)
hua=Card[rand1].color;
Card[rand1].color=Card[rand2].color;
Card[rand2].color=hua;
dian=Card[rand1].number;
纸牌游戏:十点半 来自淘豆网m.daumloan.com转载请标明出处.