当前位置: 首页 > news >正文

网站建设讠金手指 22国际阿里巴巴官网首页

网站建设讠金手指 22,国际阿里巴巴官网首页,莱芜网站排名价格,矿产网站建设价格本变博客源于自己想复习一下C语言#xff0c;所以便自己动手复习了一下链表的相关操作。做个人记录使用。 main.c #include stdio.h #include list.hint main() {student *a;printf(hello world\n) ;printf(----初始化列表----------\…本变博客源于自己想复习一下C语言所以便自己动手复习了一下链表的相关操作。做个人记录使用。 main.c #include stdio.h #include list.hint main() {student *a;printf(hello world\n) ;printf(----初始化列表----------\n);ainit();printf(----创建列表----------\n);create_front_list(a,3);printf(list的个数为count %d\n,count);printf(----读取列表3位置上数据----------\n);read_any_list(a,3);printf(------------读取全部数据------------------\n);read_all_list(a);printf(----------插入列表插入到位4的后面--------------------\n);insert_behind_list(a ,4);printf(----------插完后的列表数据---------\n);read_all_list(a);printf(------------删除列表指定位置的数据-------------------\n);delete_list(a,2);printf(-------------删除后列表的数据------------------\n);read_all_list(a);return 0; } list.c #includestdio.h #include stdlib.h #include list.h int count 0; student *init() {//chuangjian节点student * head(struct student *)malloc(sizeof(student));if(headNULL){printf(nmalloc failed \n);return NULL;}head-num0;head-score99.2;head-nextNULL;count;return head;}//链表的建立 void create_front_list(student *head,int n) { int i;student * last;student * s;lasthead;shead;printf(请你输入%d个整数\n,n);for(i0;in;i){printf(begin to input\n);s-next(struct student *)malloc(sizeof(student));lasts-next;slast;scanf(%d,%f,(s-num),(s-score));printf(end to input\n);count;}s-nextNULL;lastNULL;sNULL;return ; }//链表的读取操作 void read_all_list(student * head) {int i;printf(total data in list is \n);student *rehead;if(headNULL){printf(NO data\n);return ;}else{for(i0;icount;i){printf(num %d score %f \n,re-num, re-score);rere-next;}}}//读取其中指定第几个节点的数值 void read_any_list(student * head,int n) { int i1;student *rehead;printf(That you want to read list sequence is %d\n,n);if(ncount){printf(The number you have input exceeds the max length of this list \n );return ;}else{while(true){rere-next;i;if(in){printf(the number has been find ,data as follow \n);printf(num %d, score %f\n,re-num,re-score);break;}}return ;}}//链表的插入//由于是单链表所以我这里只使用尾部 void insert_behind_list(student * head ,int n) {printf(insert behind list \n\n);int i;student * shead;if(ncount){//表名插入的位置已经查过了节点长度printf(you has exceed this max length\n);return ;}else{ //开辟一个新的节点student * last(struct student *)malloc(sizeof(student));printf(please input your inserted data \n);scanf(%d,%f,(last-num),(last-score));for(i1;in;i){ss-next;//借助一个指针指向你想插入的节点前面}last-nexts-next;s-nextlast;lastNULL;printf(---------end of insert data--------\n);count;}}//链表的删除 void delete_list(student * head,int n) {int i;student * shead;student * qhead-next;printf(the number do you want to delete is number %d,n);if(ncount){printf(there are no data \n);}else{for(i1;in;i){ss-next;qq-next;}printf(你想删除的数据是%d,%f,q-num,q-score);s-nextq-next;free(q);count--;//记录节点的个数的}} list.h #define true 1 #define flase 0typedef struct student{int num;float score;struct student *next ;}student; extern int count; student *init(); void create_front_list(student *head,int n); void read_all_list(student * head); void read_any_list(student * head,int n); void insert_behind_list(student * head ,int n); void delete_list(student * head,int n); 备注每次更改操作后必须使用count–,否则内存就会出现泄漏。   hello world ----初始化列表---------- ----创建列表---------- 请你输入3个整数 begin to input 1,1 end to input begin to input 2,2 end to input begin to input 3,3 end to input list的个数为count 4 ----读取列表3位置上数据---------- That you want to read list sequence is 3 the number has been find ,data as follow num 2, score 2.000000 ------------读取全部数据------------------ total data in list is num 0 score 99.199997 num 1 score 1.000000 num 2 score 2.000000 num 3 score 3.000000 ----------插入列表插入到位4的后面-------------------- insert behind list please input your inserted data 4,4 ---------end of insert data-------- ----------插完后的列表数据--------- total data in list is num 0 score 99.199997 num 1 score 1.000000 num 2 score 2.000000 num 3 score 3.000000 num 4 score 4.000000 ------------删除列表指定位置的数据------------------- the number do you want to delete is number 2你想删除的数据是2,2.000000-------------删除后列表的数据------------------ total data in list is num 0 score 99.199997 num 1 score 1.000000 num 3 score 3.000000 num 4 score 4.000000 Process returned 0 (0x0) execution time : 27.276 s Press any key to continue.
http://www.hkea.cn/news/14584263/

相关文章:

  • 网站建站程序新手建网站推荐
  • php网站挂马网店网络推广策划方案
  • 备案ip 查询网站查询网站做一个网站的流程是什么
  • 网站搜索引擎优化公司wordpress 注册超时
  • 以域名做网站关键词做网站的素材
  • 网站每个页面关键词都一样公共资源交易中心网站建设汇报
  • 黔西网站建设用自己主机做网站视频
  • 深圳自己做网站 服务器网站禁止访问
  • 个人网站怎么做打赏搭建电商平台方案
  • 能力建设和继续教育中心网站杭州网站网站建设
  • 如何利用国外网站开发客户wordpress 首页文章列表
  • 哈尔滨百度网站排名公司做网站费用记到哪个科目
  • 网站建设要如何选择网站代码结构
  • 安卓手机做网站服务器吗平面设计公司经营范围
  • 网站 详细设计郑州知名网站建设公司排名
  • 普通电脑怎么做网站服务器网站建设实训心得及收获
  • 苏州建设职业技术学院招聘信息网站tp做网站签到功能
  • 网站建设案例分享网站开发简单吗
  • 肯尼亚网站域名手机视频制作软件最火
  • 模板和网站是一体的吗php网站后台开发
  • 搞网站比较好的网页模板网站
  • 广州网站开发制作内网网站建设流程
  • 东莞网站推广定制公司广州网站制作后缀
  • 手机新手学做网站买国外域名 网站
  • 桂林旅游网站建设外贸网站建设 佛山
  • 网站原创性百度官方下载安装
  • wordpress主题 mohtml系统优化是什么意思
  • 设计师一般用什么网站花卉公司网页设计
  • c 网站开发视频教程 高清西安网站建设
  • 廊坊文安建设局网站三合一网站开发