【求助】调试中断运行,输出显示不全,代码如下
程序代码:
#include<stdio.h> #include<stdlib.h> #include<time.h > #include<conio.h> struct card {char *face; char *suit; }; typedef struct card Card; void fillDeck(Card *,char *[],char *[]); void shuffle(Card *); void deal(Card *); int main() { Card deck[52]; char *face[]={"1","2","3","4","5","6","7","8","9","10","11","12","13"}; char *suit[]={"H","D","C","S"}; srand (time(NULL)); fillDeck(deck,face,suit); shuffle(deck); deal(deck); return 0; } void fillDeck(Card *wDeck,char *wFace[],char *wSuit[]) { int i; for(i=0;i<51;i++) { wDeck[i].face=wFace[i%13]; wDeck[i].suit=wSuit[i/13]; } } void shuffle(Card *wDeck) { int i,j; Card temp; for(i=0;i<=51;i++) { j=rand()%52; temp=wDeck[i]; wDeck[i]=wDeck[j]; wDeck[j]=temp; } } void deal(Card *wdeck) { int i; for(i=0;i<=51;i++) printf("%2s--%2s%c",wdeck[i].suit,wdeck[i].face,(i+1)%4?'\t':'\n'); }
[此贴子已经被作者于2017-8-16 14:06编辑过]