欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOCX文档下载  

    仓库管理系统 C语言 C++ 数据结构 链表 课程设计.docx

    • 资源ID:3259294       资源大小:37.80KB        全文页数:12页
    • 资源格式: DOCX        下载积分:6.99金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要6.99金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    仓库管理系统 C语言 C++ 数据结构 链表 课程设计.docx

    仓库管理系统 C语言 C+ 数据结构 链表 课程设计#include &ltstdio.h&gt#include &ltstdlib.h&gt#include &ltstring.h&gt#include &ltconio.h&gt#define MAX 64typedef struct node /* 定义结构体类型dnode */int number; /* 货物编号 */char nameMAX; /* 货物名称 */int counter; /* 货物数量 */struct node *prior,*next; /* 前驱和后继指针 */dnode;dnode* head = NULL;void output_one(dnode* n)/* 输出一条记录 */printf("%dt%st%dn", n-&gtnumber, n-&gtname, n-&gtcounter);void output/* 输出所有记录 */dnode* pos = head;if(head = NULL)return;while (pos)output_one(pos);/* 循环调用output_one */pos = pos-&gtnext;int insert/* 插入一条数据 */dnode* pos = head;dnode* n = malloc(sizeof(dnode);n-&gtprior = NULL;n-&gtnext = NULL;printf("请输入货物编号:");scanf("%d", &n-&gtnumber);printf("请输入货物名称:");scanf("%s", n-&gtname);printf("请输入货物数量:");scanf("%d", &n-&gtcounter);if(head=NULL)/* 如果还没有头节点,就作为头节点 */head = n;return 1;while (pos)if(pos-&gtnumber &gt n-&gtnumber)/* 按顺序查找,如果找到比自己大的,就插在它前面 */if(pos-&gtprior)pos-&gtprior-&gtnext = n;n-&gtprior = pos-&gtprior;pos-&gtprior = n;if(pos-&gtnext)pos-&gtnext-&gtprior = n;n-&gtnext = pos;return 1;else if(pos-&gtnumber = n-&gtnumber)free(n);return 0;/* 有重复数据,插入不成功 */if (!pos-&gtnext)/* 如果已经到链表尾部,插入到后面 */pos-&gtnext = n;n-&gtprior = pos;return 1;pos = pos-&gtnext;return 1;void initwhile (1)/* 初始化,循环插入 */insert;printf("按任意键继续输入,按Esc停止输入n");if(getch=27)break;int delete/* 删除一条记录 */int num;dnode* pos = head;printf("请输入要删除的编号:");scanf("%d", &num);if(head = NULL)return 0;while (pos)if(pos-&gtnumber = num)/* 找到匹配的项 */if(pos-&gtprior)pos-&gtprior-&gtnext = pos-&gtnext;if(pos-&gtnext)pos-&gtnext-&gtprior = pos-&gtprior;free(pos);return 1;pos = pos-&gtnext;return 0;/ 没找到int amend/* 修改数量 */int num, count;dnode* pos = head;printf("请输入要修改的编号:");scanf("%d", &num);printf("请输入要修改的数量:");scanf("%d", &count);if(head = NULL)return 0;while (pos)if(pos-&gtnumber = num)if (count = 0)/* 如果数量是0,就删除 */if(pos-&gtprior)pos-&gtprior-&gtnext = pos-&gtnext;if(pos-&gtnext)pos-&gtnext-&gtprior = pos-&gtprior;free(pos);return 1;pos-&gtcounter = count;return 1;pos = pos-&gtnext;return 0;void search/* 按编号查找 */int num;dnode* pos = head;printf("请输入要查找的编号:");scanf("%d", &num);if(head = NULL)return;while (pos)if(pos-&gtnumber = num)output_one(pos);/* 找到就打印 */return;pos = pos-&gtnext;void search_by_name/* 按名称查找 */char nameMAX;dnode* pos = head;printf("请输入要查找的名称:");scanf("%s", name);if(head = NULL)return;while (pos)if(!strcmp(pos-&gtname, name)output_one(pos);pos = pos-&gtnext;int maininit;while (1)char ch;system("cls");printf("tttti 增加新货物n");printf("ttttd 删除某种货物n");printf("tttta 修改某种货物的数量n");printf("tttts 查找指定的货物n");printf("tttto 输出存货信息n");printf("ttttq 退出程序n");ch = getch;switch (ch)case 'i':case 'I':insert;break;case 'd':case 'D':delete;break;case 'a':case 'A':amend;break;case 's':case 'S':printf("1. 按编号查找n2. 按名称查找n");ch = getch;if(ch = '1')search;else if(ch = '2')search_by_name;break;case 'o':case 'O':output;break;case 'q':case 'Q':return 0;break;printf("按任意键继续.n");getch;return 0;

    注意事项

    本文(仓库管理系统 C语言 C++ 数据结构 链表 课程设计.docx)为本站会员(小飞机)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开