欢迎来到天天文库
浏览记录
ID:37710779
大小:17.50 KB
页数:5页
时间:2019-05-29
《C程序设计教程与实验(吉顺如 陶恂)实验9答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Sy9-1#includestructstud{charname[20];intage;};structstudfun(structstudperson[],intn){intmin,i;min=0;for(i=0;i2、minpers;minpers=fun(a,n);printf("%s是年龄小者,年龄是:%d",minpers.name,minpers.age);}Sy9-2#include#include#defineNUM4structstudent{intrank;/*学生排名*/charname[4];/*学生姓名*/floatscore;/*学生成绩*/}stu[]={3,"Tom",89.3,4,"Mary",78.2,1,"Jack",95.1,2,"Jim",90.6};main(){charst3、r[10];inti;do{printf("Entreaname:");scanf("%s",str);for(i=0;i=NUM)printf("Notfound");}while(strcmp(str,"0")!=0);}S4、y9-4#include#defineN4structstudent{intscore;/*学生成绩*/charname[10];/*学生姓名*/}s[N];voidmain(){inti,score90,score80,score70,score60,score_failed;for(i=0;i5、d=0;for(i=0;istatics6、tructperson{charname[20];intage;}person[]={"li-ming",18,"wang-hua",19,"zhang-ping",20};main(){inti,max,min;max=min=person[0].age;for(i=1;i<3;i++)if(person[i].age>max)max=person[i].age;elseif(person[i].age7、].age!=min){printf("%s%d",person[i].name,person[i].age);break;}}Sy9-6#includestructnode{chardata;structnode*link;}*head;ins(structnode*q){if(head==NULL){q->link=NULL;head=q;}else{q->link=head;head=q;}}main(){charch;structnode*p;head=NULL;while((ch=getchar())!='8、'){p=(structnode*)malloc(sizeof(structnode));p->data=ch;ins(p);}p=head;while(p!=NU
2、minpers;minpers=fun(a,n);printf("%s是年龄小者,年龄是:%d",minpers.name,minpers.age);}Sy9-2#include#include#defineNUM4structstudent{intrank;/*学生排名*/charname[4];/*学生姓名*/floatscore;/*学生成绩*/}stu[]={3,"Tom",89.3,4,"Mary",78.2,1,"Jack",95.1,2,"Jim",90.6};main(){charst
3、r[10];inti;do{printf("Entreaname:");scanf("%s",str);for(i=0;i=NUM)printf("Notfound");}while(strcmp(str,"0")!=0);}S
4、y9-4#include#defineN4structstudent{intscore;/*学生成绩*/charname[10];/*学生姓名*/}s[N];voidmain(){inti,score90,score80,score70,score60,score_failed;for(i=0;i5、d=0;for(i=0;istatics6、tructperson{charname[20];intage;}person[]={"li-ming",18,"wang-hua",19,"zhang-ping",20};main(){inti,max,min;max=min=person[0].age;for(i=1;i<3;i++)if(person[i].age>max)max=person[i].age;elseif(person[i].age7、].age!=min){printf("%s%d",person[i].name,person[i].age);break;}}Sy9-6#includestructnode{chardata;structnode*link;}*head;ins(structnode*q){if(head==NULL){q->link=NULL;head=q;}else{q->link=head;head=q;}}main(){charch;structnode*p;head=NULL;while((ch=getchar())!='8、'){p=(structnode*)malloc(sizeof(structnode));p->data=ch;ins(p);}p=head;while(p!=NU
5、d=0;for(i=0;istatics
6、tructperson{charname[20];intage;}person[]={"li-ming",18,"wang-hua",19,"zhang-ping",20};main(){inti,max,min;max=min=person[0].age;for(i=1;i<3;i++)if(person[i].age>max)max=person[i].age;elseif(person[i].age7、].age!=min){printf("%s%d",person[i].name,person[i].age);break;}}Sy9-6#includestructnode{chardata;structnode*link;}*head;ins(structnode*q){if(head==NULL){q->link=NULL;head=q;}else{q->link=head;head=q;}}main(){charch;structnode*p;head=NULL;while((ch=getchar())!='8、'){p=(structnode*)malloc(sizeof(structnode));p->data=ch;ins(p);}p=head;while(p!=NU
7、].age!=min){printf("%s%d",person[i].name,person[i].age);break;}}Sy9-6#includestructnode{chardata;structnode*link;}*head;ins(structnode*q){if(head==NULL){q->link=NULL;head=q;}else{q->link=head;head=q;}}main(){charch;structnode*p;head=NULL;while((ch=getchar())!='
8、'){p=(structnode*)malloc(sizeof(structnode));p->data=ch;ins(p);}p=head;while(p!=NU
此文档下载收益归作者所有