c语言物流管理系统完整代码.docx
- 文档编号:29744653
- 上传时间:2023-07-26
- 格式:DOCX
- 页数:22
- 大小:17.84KB
c语言物流管理系统完整代码.docx
《c语言物流管理系统完整代码.docx》由会员分享,可在线阅读,更多相关《c语言物流管理系统完整代码.docx(22页珍藏版)》请在冰豆网上搜索。
c语言物流管理系统完整代码
#include
#include
#include
#include
structstuff//定义员工数据结构体
{
charname[10];
charpassword[10];
charquanxian[2];
};
structgoods//定义货品数据结构体
{
charnumber[20];
charname[20];
intquantity;
charcost[20];
charvolume[20];
charweight[20];
};
typedefstructa
{
structstuffs;
structa*next;
}stuffnode;
typedefstructb
{
structgoodsg;
structb*next;
}goodsnode;
stuffnode*stuffhead=NULL;//全局结构体链表指针变量头指针
stuffnode*stuffp1=NULL;
goodsnode*goodshead=NULL;
goodsnode*goodsp1=NULL;
voidinitial_stuff()
{
FILE*fp;
stuffnode*p;
if((fp=fopen("stuff.txt","r"))==NULL)//以只读方式打开文件
{
printf("请新建员工信息!
\n\n");
}
else
{
fseek(fp,0,SEEK_END);//定位到文件末尾
intn,i;
n=ftell(fp)/sizeof(structstuff);
rewind(fp);//这是一个反绕函数,使文件的位置指针定位到文件的开头
for(i=0;i { p=(stuffnode*)malloc(sizeof(stuffnode));//计算stuffnode所占内存空间,然后将返回的指针强制转换成stuffnode* fread(&p->s,sizeof(p->s),1,fp);//从文件FP中读取数据到P中 p->next=NULL;//p指针指向的对象的next属性为空 if(stuffhead==NULL) { stuffhead=stuffp1=p; } else { stuffp1->next=p; stuffp1=stuffp1->next; } } fclose(fp); } } voidinitial_goods() { FILE*fp; goodsnode*p; if((fp=fopen("goods.txt","r"))==NULL) { printf("请新建物流信息! \n\n"); } else { fseek(fp,0,SEEK_END); intn,i; n=ftell(fp)/sizeof(structgoods); rewind(fp); for(i=0;i { p=(goodsnode*)malloc(sizeof(goodsnode)); fread(&p->g,sizeof(p->g),1,fp); p->next=NULL; if(goodshead==NULL) { goodshead=goodsp1=p; } else { goodsp1->next=p; goodsp1=goodsp1->next; } } fclose(fp); } } voidaddstuff()//增加员工 { stuffnode*p; p=(stuffnode*)malloc(sizeof(stuffnode)); printf("\n\n\n\n☆☆增加员工资料☆☆\n"); printf("\n请输入员工姓名\n\n"); scanf("%s",p->s.name); printf("\n请输入员工密码\n\n"); scanf("%s",p->s.password); printf("\n请输入员工权限(Y/N)\n\n"); scanf("%s",p->s.quanxian); p->next=NULL; if(stuffhead) { stuffp1->next=p; stuffp1=stuffp1->next; } else stuffhead=stuffp1=p; printf("\n增加员工数据成功\n\n"); } voiddeletestuff()//删除员工资料 { stuffnode*p,*p1; p=p1=stuffhead; charflag[20]; printf("\n请输入要删除员工的名称。 \n"); scanf("%s",flag); while(strcmp(p->s.name,flag)! =0) { p1=p; p=p->next; }; printf("该员工数据即将删除: \n"); printf("名称,密码,权限\n"); printf("%s%s%s\n",p->s.name,p->s.password,p->s.quanxian); p1->next=p->next; printf("\n删除完毕\n"); } voidshowstuff()//员工资料显示 { stuffnode*p=stuffhead; if(p==NULL) { printf("员工信息为空! \n\n"); } else { printf("员工资料: \n"); printf("名称密码权限\n"); while(p) { printf("%s%s%s\n",p->s.name,p->s.password,p->s.quanxian); p=p->next; } } } voidaddgoods()//货品入库 { goodsnode*p; p=(goodsnode*)malloc(sizeof(goods)); printf("\n\n\n\n☆☆货品入库☆☆\n"); printf("\n\n请输入货品编号\n\n"); scanf("%s",p->g.number); printf("\n请输入货品名称\n\n"); scanf("%s",p->g.name); printf("\n请输入件数\n\n"); scanf("%d",&p->g.quantity); printf("\n请输入保价费\n\n"); scanf("%s",p->g.cost); printf("\n请输入货品体积\n\n"); scanf("%s",p->g.volume); printf("\n请输入货品重量\n\n"); scanf("%s",p->g.weight); p->next=NULL; if(goodshead) { goodsp1->next=p; goodsp1=goodsp1->next; } else goodshead=goodsp1=p; printf("\n货品成功入库\n\n"); } voidoutputgoods()//货品出库 { goodsnode*p,*p1; p=p1=goodshead; charflag[20]; printf("\n请输入出货货品的编号。 \n"); scanf("%s",flag); while(strcmp(p->g.number,flag)! =0) { p1=p; p=p->next; }; printf("\n出货货品为: "); printf("\n|-------------------------------------------------------------|\n"); printf("|编号|品名|数量|保价(元)|体积(M3)|重量(KG)|"); printf("\n|-------------------------------------------------------------|\n"); printf("%s%s%d%s%s%s\n", p->g.number,p->g.name,p->g.quantity,p->g.cost,p->g.volume,p->g.weight); p1->next=p->next; printf("成功出货! \n"); } voidquerygoods()//货品查询 { goodsnode*p,*p1; p=p1=goodshead; charflag[20]; printf("\n请输入查询货品的编号。 \n"); scanf("%s",flag); while(strcmp(p->g.number,flag)! =0) { p1=p; p=p->next; }; printf("查询的货品信息为: "); printf("\n|-------------------------------------------------------------|\n"); printf("|编号|品名|数量|保价(元)|体积(M3)|重量(KG)|"); printf("\n|-------------------------------------------------------------|\n"); printf("%s%s%d%s%s%s\n", p->g.number,p->g.name,p->g.quantity,p->g.cost,p->g.volume,p->g.weight); } voidcheckgoods()//货品盘点,显示仓库所有货品 { goodsnode*p=goodshead; if(p==NULL) printf("货品信息为空! \n\n"); else { printf("仓库货品为: "); printf("\n|-------------------------------------------------------------|\n"); printf("|编号|品名|数量|保价(元)|体积(M3)|重量(KG)|"); printf("\n|-------------------------------------------------------------|\n"); } while(p) { printf("%s%s%d%s%s%s\n", p->g.number,p->g.name,p->g.quantity,p->g.cost,p->g.volume,p->g.weight); p=p->next; } } voidsetquanxian()//员工权限设置 { stuffnode*p,*p1; p=p1=stuffhead; charflag[20]; printf("\n请输入要设置权限的员工的名称。 \n"); scanf("%s",flag); while(strcmp(p->s.name,flag)! =0) { p1=p; p=p->next; }; printf("该员工权限即将变更: \n"); printf("%s,%s,%s\n",p->s.name,p->s.password,p->s.quanxian); p1->next=p->next; printf("\n更改完毕\n"); } voidmamgxinxi()//信息管理 { } voidsavestuff() { FILE*fp; fp=fopen("stuff.txt","w"); stuffnode*p=stuffhead; while(p) { fwrite(&p->s,sizeof(p->s),1,fp); p=p->next; } fclose(fp); } voidsavegoods() { FILE*fp; fp=fopen("goods.txt","w"); goodsnode*p=goodshead; while(p) { fwrite(&p->g,sizeof(p->g),1,fp); p=p->next; } fclose(fp); } voidshow() { printf("\n"); printf("\n■■■■■■■■■■■■■■■■■■■■■■■■■■■"); printf("\n■☆■■■■■■■■■■■■■■■■■■■■■■■☆■"); printf("\n■☆■欢迎使用■☆■"); printf("\n■☆■------------------------------------------■☆■"); printf("\n■☆■智能物流管理系统■☆■"); printf("\n■☆■------------------------------------------■☆■"); printf("\n■☆■www.ZNWLGLXT.com■☆■"); printf("\n■☆■■■■■■■■■■■■■■■■■■■■■■■☆■"); printf("\n■■■■■■■■■■■■■■■■■■■■■■■■■■■"); printf("\n"); printf("\n"); } voidshow1() { printf("\n|----------------------------------------|"); printf("\n|█主菜单█|"); printf("\n|----------------------------------------|"); printf("\n|A基础信息管理|"); printf("\n|----------------------------------------|"); printf("\n|B配送管理|"); printf("\n|----------------------------------------|"); printf("\n|C仓储管理|"); printf("\n|----------------------------------------|"); printf("\n|D系统管理|"); printf("\n|----------------------------------------|"); printf("\n|E退出程序|"); printf("\n|----------------------------------------|"); printf("\n|请您选择一个任务|"); printf("\n|----------------------------------------|\n\n\n"); } voidshow2() { printf("\n|-----------------------------|"); printf("\n|☆基础信息管理菜单☆|"); printf("\n|-----------------------------|"); printf("\n|A增加员工|"); printf("\n|-----------------------------|"); printf("\n|B删除员工|"); printf("\n|-----------------------------|"); printf("\n|C显示员工|"); printf("\n|-----------------------------|"); printf("\n|D退出程序|"); printf("\n|-----------------------------|"); printf("\n|请您选择一个任务|"); printf("\n|-----------------------------|\n\n\n"); } voidshow3() { printf("\n|-----------------------------|"); printf("\n|☆配送管理菜单☆|"); printf("\n|-----------------------------|"); printf("\n|A配送申请|"); printf("\n|-----------------------------|"); printf("\n|B配送查询|"); printf("\n|-----------------------------|"); printf("\n|C在途管理|"); printf("\n|-----------------------------|"); printf("\n|D退出程序|"); printf("\n|-----------------------------|"); printf("\n|请您选择一个任务|"); printf("\n|-----------------------------|\n\n\n"); } voidshow4() { printf("\n|-----------------------------|"); printf("\n|☆仓储管理菜单☆|"); printf("\n|-----------------------------|"); printf("\n|A货品入库|"); printf("\n|-----------------------------|"); printf("\n|B货品出库|"); printf("\n|-----------------------------|"); printf("\n|C货品查询|"); printf("\n|-----------------------------|"); printf("\n|D货品盘点|"); printf("\n|-----------------------------|"); printf("\n|E退出程序|"); printf("\n|-----------------------------|"); printf("\n|请您选择一个任务|"); printf("\n|-----------------------------|\n\n\n"); } voidshow5() { printf("\n|-----------------------------|"); printf("\n|☆系统管理菜单☆|"); printf("\n|-----------------------------|"); printf("\n|A权限设置|"); printf("\n|-----------------------------|"); printf("\n|B信息维护|"); printf("\n|-----------------------------|"); printf("\n|C退出程序|"); printf("\n|-----------------------------|"); printf("\n|请您选择一个任务|"); printf("\n|-----------------------------|\n\n\n"); } intmain() { show(); initial_stuff(); initial_goods(); charname1[10]; charpassword1[15]; printf("请输入用户名: \n"); scanf("%s",name1); printf("请输入用户密码: \n"); scanf("%s",password1); stuffnode*p2; intquanxianflag=0; p2=stuffhead; while(p2! =NULL) { if((strcmp(p2->s.name,name1)==0&&strcmp(p2->s.password,password1)==0)&& ((strcmp(p2->s.quanxian,"y")==0||strcmp(p2->s.quanxian,"Y")==0))) { quanxianflag=1; break; } else { p2=p2->ne
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 物流 管理 系统 完整 代码