回复 9楼 给力芬2010
应该初始化没问题的···
2011-03-23 17:35
2011-03-23 17:36
2011-03-23 17:45
2011-03-23 18:01
程序代码:#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
typedef struct
{
char suit[10];
char face[10];
}change;
change card[52]; //全局变量
char *face[]={"1","2","3","4","5","6","7","8","9","10","jack","queen","king"};
char *suit[]={"spade","hearts","clubs","diamonds"};
void start(change card[],char *face[],char *suit[])
{
int a;
for(a=0;a<52;a++)
{
strcpy(card[a].face,face[a%13]); //原来的face[]是一个字符数组 现在的face为字符串数组指针 strcpy需要前后都为字符串
strcpy(card[a].suit,suit[a/13]); //求除
printf("%s\n",card[a].face);
printf("%s\n",card[a].suit);
}
}
int main()
{
start(card,face,suit);
return 0;
}
2011-03-23 19:25
2011-03-23 20:08
2011-03-23 20:55
2011-03-24 01:46

2011-03-24 08:28
2011-03-24 08:43