|
谁帮我看看和修改一下错误(里面有十个错误,你用win-tc运行一下就可以知道了)~~:m35 :m35
/*洗牌与发牌程序*/
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
/*函数原型*/
void shuffle (int wDeck[][13]);
void deal (const int wdeck[][13],const char *wFace[],const char *wSuit[]);
int main ()
{/*初始化数组suit*/
const char *suit[4]={"Hearts","Diamonds","Clubs","Spades"};
/*初始化数组face*/
const char *face[]={"Ace","Deuce","Three","Four","Five","Six",
"Seven","Eight","Nine","Ten","Jack","Queen","King"};
/*初始化数组desk*/
int desk [4][13]={0};
srand(time(0));/*设置随机发生器的种子*/
shuffle(deck);
deal (deck,face,suit);return 0;/*表示程序成功结束*/}/*函数main结束*/
/*洗牌*/
void shuffle (int wDeck [][13]);
{int row; /*行*/
int column; /*列*/
int card; /*计数器*/
/*对52张牌中的每一张,随机选择一个纸牌中的位置*/
for (card=1;card<=52;card++);
{
/*选择新的随机位置直到找到一个没有分配的位置*/
do{row=rand()%4;
colum=rand()%13;
}while(wDeck[row][colum]!=0);/*结束do/while*/
/*将牌放在选择的位置中*/
wDeck[row][colum]=card;
}/*结束for*/
}/*结束函数shuffle*/
/*发牌*/
void deal (const int wDeck[][13],const char *wFace,const char *suit[])
{int card; /*计数器*/
int row; /*行*/
int column; /*列*/
/*发每一张牌*/
for (card=1;card<=3;row++){
/*循环wDeck中的每一行*/
for (row=0;row<=3;row++){
/*循环wDeck当前行的每一列*/
for (colum=0;colum<=12;colum++){
/*如果当前位置有牌,则显示*/
if (wDeck [row][colum]==card){
printf("%5s of%-8s%c",wFace[colum],wSuit[row],
card%2==0?'\n':'\t');
}/*结束if*/
}/*结束for*/
}/*结束for*/
}/*结束for*/
}/*结束函数deal*/ |
|