第11章第1讲结构体
#include"stdio.h" struct student { int number; char name[8]; char sex[8]; int age; float c_program; }stu[5]={ {35013101,"王 迪",'F',20,90}, {35013105,"赵晶晶",'F',21,95}, {35013112,"杨 光",'M',19,80}, {35013125,"周腾巍",'M',21,93}, {35013130,"孙益龙",'M',20,100} }; main() { int i; float ave,sum=0; for(i=0;i<=4;i++) sum=sum+stu[i].c_program; ave=sum/5; printf("ave=%.1f\n",ave); }