3、h>#include#defineSTUstructstudentSTU第10章章結(jié)構(gòu)體、共用體和枚舉類(lèi)型195{longnum;charname[10];charsex;intage;floatscore;};voidmain(){STUstudent1;printf("num:");scanf("%ld",&student1.num);/*輸入student1的各成員值*/printf("name:");getchar();/*濾掉輸入student1.num后所加的回車(chē)符*/gets(student1.name);p
4、rintf("sex(M/F):");scanf("%c",&student1.sex);printf("age:");scanf("%d",&student1.age);printf("score:");scanf("%f",&student1.score);/*輸出student1的各成員值*/printf("num:%ld",student1.num);printf("name:%s",student1.name);printf("sex:%c",student1.sex);printf("age:%d",student
5、1.age);printf("score:%f",student1.score);}#includestructdate{intmonth;intday;intyear;};structstudent{longnum;charname[10];charsex;structdatebirthday;charaddr[30];};voidmain(){structstudentstud1={990801,"LiMing",'M',{9,12,1981},"HongKong"};第10章章結(jié)構(gòu)體、共用體和枚舉類(lèi)型195prin
6、tf("num:%ld",stud1.num);printf("name:%s",stud1.name);printf("sex:%c",stud1.sex);printf("birthday:%d/%d/%d",stud1.birthday.month,stud1.birthday.day,stud1.birthday.year);printf("address:%s",stud1.addr);}10.3結(jié)構(gòu)體數(shù)組structstudent{longintnum;charname[10];floatscore;}stus
7、[3];structstudent{longintnum;charname[10];floatscore;}stus[3]={{990801,"LiMing",92.5},{990802,"LuYun",89.0},{990803,"YangHong",96.5}};#defineMAX30#includestructstuscore{longintnum;charname[10];intscore[3];inttotal;};voidmain(){structstuscorestu[MAX];第10章章結(jié)構(gòu)體、共用體和枚舉
8、類(lèi)型195inti;for(i=0;i