仓库管理系统 C语言 C++ 数据结构 链表 课程设计.docx
《仓库管理系统 C语言 C++ 数据结构 链表 课程设计.docx》由会员分享,可在线阅读,更多相关《仓库管理系统 C语言 C++ 数据结构 链表 课程设计.docx(12页珍藏版)》请在三一办公上搜索。
1、仓库管理系统 C语言 C+ 数据结构 链表 课程设计#include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>#define MAX 64typedef struct node /* 定义结构体类型dnode */int number; /* 货物编号 */char nameMAX; /* 货物名称 */int counter; /* 货物数量 */struct node *prior,*next; /* 前驱和后继指针 */dnode;dnode* head = NULL
2、;void output_one(dnode* n)/* 输出一条记录 */printf(%dt%st%dn, n->number, n->name, n->counter);void output/* 输出所有记录 */dnode* pos = head;if(head = NULL)return;while (pos)output_one(pos);/* 循环调用output_one */pos = pos->next;int insert/* 插入一条数据 */dnode* pos = head;dnode* n = malloc(sizeof(dnode);n->p
3、rior = NULL;n->next = NULL;printf(请输入货物编号:);scanf(%d, &n->number);printf(请输入货物名称:);scanf(%s, n->name);printf(请输入货物数量:);scanf(%d, &n->counter);if(head=NULL)/* 如果还没有头节点,就作为头节点 */head = n;return 1;while (pos)if(pos->number > n->number)/* 按顺序查找,如果找到比自己大的,就插在它前面 */if(pos->prior)pos->pri
4、or->next = n;n->prior = pos->prior;pos->prior = n;if(pos->next)pos->next->prior = n;n->next = pos;return 1;else if(pos->number = n->number)free(n);return 0;/* 有重复数据,插入不成功 */if (!pos->next)/* 如果已经到链表尾部,插入到后面 */pos->next = n;n->prior = pos;return 1;pos = pos->next;return 1;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 仓库管理系统 C语言 C+ 数据结构 链表 课程设计 仓库 管理 系统 语言
链接地址:https://www.31ppt.com/p-3259294.html