问题描述
- 洗牌问题,无法运行,求解原因
-
代码如下:
#include
#include
#include
#includestruct POKER
{
char suit[10];
char face[5];
};
typedef struct POKER Poker;void main(void)
{
Poker card[52],temp;
int i,j;
char *Suit[] = {"Spades","Hearts","Clubs","Diamonds"};
char *Face[] = {"A","2","3","4","5","6","7","8","9","10","Jack","Queen","King"};for(i=0;i<52;i++) { strcpy(card[i].suit,Suit[i/13]); strcpy(card[i].face,Suit[i%13]); } srand(time(NULL)); for(i=0;i<52;i++) { j = rand()%52; temp = card[i]; card[i] = card[j]; card[j] = temp; } printf("洗牌的结果如下:n"); for(i=0;i<52;i++) { printf("%10s%10sn",card[i].suit,card[i].face); }
}
我是在VC6.0下运行的,编译没有报错,但是不能运行,为什么呀?
时间: 2024-10-07 13:28:32