欢迎来到天天文库
浏览记录
ID:52298100
大小:27.00 KB
页数:3页
时间:2020-03-26
《本科C语言程序设计教程教学资料包课后习题答案 第十章习题答案.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、第十章一、选择CADBDDCDCDCDDDC二、编程Structwork{longnum;floatgz;};创建structwork*Create(structwork*head){structwork*this,*new;new=(structwork*)malloc(sizeof(structstru));if(head==NULL)head=new;else{this=head;while(this->next!=NULL)this=this->next;this->next=new;new->next=nullsc
2、anf(“%ld”,&new->num);scanf(“%f”.,&gz);}endifreturn(head);}浏览voidlist(structwork*head){structwork*this,*new;if(head==null)printf(“nodata!”);else{this=head;do{printf(“%ld,%f”,this->num,this->gz);this=this->next;}while(this!=NULL);endif}}插入structwork*insert(structwo
3、rk*head,longx,floaty){structwork*this,*new,*fro;new=(structwork*)malloc(sizeof(structwork));new->num=x;new->gz=y;if(head==NULL)head=new;else{this=head;while((this!=NULL)&&(this->num>x)){fro=this;this=this->next;}if(this==head){head=new;new->next=this}else{fro->next
4、=new;new->next=this;}endif}删除strucwork*del(structwork*head,intx){structwork*head,*this,*fro;this=head;while((this!=NULL)&&(this->num!=x){fro=this;thid=this-next;}if(this!=NULL)If(this==head){head=head->next;free(this);}else{fro->next=this->next;free(this);}endifend
5、if
此文档下载收益归作者所有