回复 3楼 rjsp
#include <stdio.h>
struct date
{
int year;
int month;
int day;
};
struct stu2
{
int no;
char name[10];
char sex;
float score;
struct date birthday;
}student[3];
struct stu2 student[3]={{102,"张三",'M',89.0,{1980,9,20}},
{105,"李四",'M',78.5,{1980,8,15}},
{112,"王五",'F',93.0,{1980,3,10}}
};
main()/*主函数main()*/
{
int i;
printf("No.
Name
Sex
Score
Birthday\n");/*打印表头*/
for (i=0;i<3;i++)/*输出3个学生的基本情况*/
{
printf("%-7d",student[i].no);
printf("%-10s",student[i].name);
printf("%-5s",student[i].sex);
printf("%-7.2s",student[i].score);
printf("%d-%d-%d\n",student[i].birthday.year,
student[i].birthday.month,student[i].birthday.day);
}
}
哥,这就是那个代码