1、实验 8.结构体应用 -10081 学生成绩统计(结构体)1. 【问题描述】用结构数组实现学生成绩统计各功能。某班有 N(Nstruct studentchar num10;int b5;a30;int main()void everage(struct student *p1,int m);void failure(struct student *p2,int m);void success(struct student *p3,int m);int n,i;scanf(“%d“,for(i=0;i=2)printf(“%s “,ai.num);h+;if(h=0)printf(“no“);
2、printf(“n“);void success(struct student *p3,int m)int i,j,h=0,sum=0;float everage;for(i=0;i=90)printf(“%s “,p3i.num);h+;if(h=0)printf(“no“);printf(“n“);实验 8.结构体应用 -10082 图书价格统计2. 【问题描述】用结构数组保存书的信息。现有 N(N#include struct bookchar name30;char chu15;int count;float price;a50;int main()int i,j,k,n,h;char
3、 m30=0,b15=0;float t,sum=0;scanf(“%d“,for(i=0;in;i+)scanf(“%s%s%d%f“,ai.name,ai.chu,for(i=0;in-1;i+)k=i;for(j=i+1;jn;j+)if(aj.priceak.price)k=j;if(i!=k)strcpy(m,ai.name); strcpy(ai.name,ak.name); strcpy(ak.name,m);strcpy(b,ai.chu); strcpy(ai.chu,ak.chu); strcpy(ak.chu,b);h=ai.count; ai.count=ak.count; ak.count=h;t=ai.price; ai.price=ak.price; ak.price=t;for(i=0;in;i+)printf(“%-30s%-20s%-10d%-.2fn“,ai.name,ai.chu,ai.count,ai.price);for(i=0;in;i+)sum += ai.price*ai.count;printf(“%.2fn“,sum);return 0;