欢迎来到天天文库
浏览记录
ID:18741039
大小:95.00 KB
页数:13页
时间:2018-09-22
《西北农林科技大学-软件技术基础实习报告》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、课程实验报告学年学期 课程名称 软件技术基础实验名称 单链表的创建实验室 专业年级 学生姓名 学生学号 任课教师 陈帝伊水利与建筑工程学院一、实验目的1、熟悉VC++6.0的上级环境;2、掌握线性表中链表的数据类型描述,特点及其存储结构;3、掌握单链表的基本操作,创建一个新的链表及其应用;4、掌握线性表的基本运算及应用;5、掌握基本的循环结构,以及链表建立的循环结束条件;6、掌握链表创建的核心语句。二、实验内容读入一组数建立链表,以负数作为输入结束。三、算法描述#include#include#defin
2、eLENsizeof(structstud)structstud{longnum;structstud*next;};structstud*head;voidcreat(){structstud*p,*q;p=(structstud*)malloc(LEN);head=p;head->next=NULL;q=(structstud*)malloc(LEN);scanf("%ld",&q->num);while(q->num>0){p->next=q;p=q;q=(structstud*)malloc(LEN);scanf("%ld",&q->num);}
3、p->next=NULL;}voidoutput(){structstud*p;p=head->next;while(p!=NULL){printf("%ld",p->num);p=p->next;}}main(){creat();output();}课程实验报告学年学期 课程名称 软件技术基础实验名称 单链表的删除实验室 专业年级 学生姓名 学生学号 任课教师 陈帝伊水利与建筑工程学院实验目的1、掌握线性表中链表的数据类型描述,特点及其存储结构;2、掌握单链表得到基本操作,删除链表的一个数据及应用;3、深刻理解和掌握删除链点的循环条件和循环
4、实现条件;一、实验内容检查一个单向链表,删除其中数据大于100的元素。三、算法描述#include#include#defineLENsizeof(structstud)structstud{longnum;structstud*next;};structstud*head;voidcreat(){structstud*p,*q;p=(structstud*)malloc(LEN);head=p;head->next=NULL;q=(structstud*)malloc(LEN);scanf("%ld",&q->nu
5、m);while(q->num>0){p->next=q;p=q;q=(structstud*)malloc(LEN);scanf("%ld",&q->num);}p->next=NULL;}voidoutput(){structstud*p;p=head->next;while(p!=NULL){printf("%ld",p->num);p=p->next;}}voiddel(){structstud*p,*q;p=head;q=p;p=p->next;while(p!=NULL){if(p->num>100){q->next=p->next;free
6、(p);p=q->next;continue;}q=p;p=p->next;}}main(){creat();del();output();}课程实验报告学年学期 课程名称 软件技术基础实验名称 单链表的反向输出实验室 专业年级 学生姓名 学生学号 任课教师 陈帝伊水利与建筑工程学院一、实验目的1、掌握线性表中链表的数据类型描述,特点及其存储结构;2、掌握链表的灵活处理,将一个链表反向输出;3、深刻理解算法的概念;4、掌握以程序员的角度分析问题和解决问题的能力;5、掌握链表遍历的核心语句,以及进一步的提高程序调适能力。二、实验内容讲一个单链表
7、反向输出。三、算法描述#include#include#defineLENsizeof(structstud)structstud{longnum;structstud*next;};structstud*create(){structstud*head,*p,*q;p=(structstud*)malloc(LEN);head=p;head->next=NULL;q=(structstud*)malloc(LEN);scanf("%ld",&q->num);while(q->num>0){p->next=q;p=q
8、;q=(structstud*)malloc(LEN);scanf("%ld",
此文档下载收益归作者所有