《c程序设计教程与实验(吉顺如 陶恂)实验9答案》由会员分享,可在线阅读,更多相关《c程序设计教程与实验(吉顺如 陶恂)实验9答案(5页珍藏版)》请在金锄头文库上搜索。
1、Sy9-1#includestruct stud char name20;int age; ;struct stud fun(struct stud person,int n) int min,i;min=0;for(i=0;i#include #define NUM 4struct student int rank; /* 学生排名 */char name4; /* 学生姓名 */float score; /* 学生成绩 */stu= 3,Tom,89.3,4,Mary,78.2,1,Jack,95.1, 2,Jim,90.6 ;main() char str10;int i;do prin
2、tf(Entre a name:);scanf(%s,str);for(i=0;i=NUM) printf(Not foundn); while(strcmp(str,0)!=0);Sy9-4#include #define N 4struct student int score; /* 学生成绩 */char name10; /* 学生姓名 */ sN;void main()int i, score90, score80, score70, score60, score_failed;for(i=0; istatic struct person char name20;int age; pe
3、rson=li-ming,18,wang-hua,19,zhang-ping,20 ;main() int i,max,min; max=min=person0.age;for(i=1;imax) max=personi.age;else if(personi.agestruct nodechar data;struct node *link;*head;ins(struct node *q) if(head=NULL) q-link=NULL;head=q;else q-link=head;head=q;main() char ch;struct node *p;head=NULL;whil
4、e(ch=getchar()!=n) p=(struct node*) malloc(sizeof(struct node);p-data=ch;ins(p);p=head;while(p!=NULL) printf(%c,p-data);p=p-link;Sy9-7#includestruct students char num10;char name10;float math,eng,c,sum;st5;main() int i,j,k;float max,min;for(i=0;imax) max=sti.sum;k=i;if(sti.sumstruct students char num10;char name10;float math,eng,c,sum;st5;main() int i,j,k;float max,min;for(i=0;imax) max=sti.sum;k=i;if(sti.summin) min=sti.sum;j=i;printf(%s,%sn,stk.num,stk.name);printf(%.2f,%.2f,%.2fn,stk.math,stk.eng,stk.c);printf(%s,%sn,stj.num,stj.name);printf(%.2f,%.2f, %.2fn,stj.math,stj.eng,stj.c);