C语言程序设计 物流管理系统

更新时间:2024-04-02 07:27:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

#include #include #include

typedef struct _goods { char NO[6];//编号 char name[10];//送货员姓名 char mudidi[10];//目的地 char qianshouren[15];//签收人姓名 int call;//号码 }Goods;

void insert(Goods goods[50],Goods x); void print(Goods goods[50],int temp); void printall(Goods goods[50],int i); int find(Goods goods[50],char NO[6]); void del(Goods goods[50],char NO[6]); void sortNO(Goods goods[50]); void sortlea(Goods goods[50]); void change(Goods goods[50]); void changep(Goods goods[50]); void changet(Goods goods[50]);

int num=5;//初始数

void insert(Goods goods[50],Goods x)//插入一条记录 { goods[num]=x; num++; }

void print(Goods goods[50],int temp)//输出一个模块 { printf(\ goods[temp].mudidi,goods[temp].qianshouren,goods[temp].call); }

void printall(Goods goods[50],int i)//输出所有 { int k; {

printf(\编号\\t名称\\t目的地\\t签收人\\t号码\\n\ for(k=0;k

int find(Goods goods[50],char NO[6])//查找 { int i; for(i=0;i

void del(Goods goods[50],char NO[6])//删除 { int i; int temp=find(goods,NO); if(temp==-1) printf(\不存在!\\n\ else { for(i=temp+1;i

void sortlea(Goods goods[50])//号码排序函数 { int i,j;

Goods temp; for(i=num-1;i>0;i--)

{ for(j=0;jgoods[j+1].call) { temp=goods[j]; goods[j]=goods[j+1]; goods[j+1]=temp; } else continue; } } printall(goods,1); }

void sortNO(Goods goods[50])//订单排序 { int i,j; Goods temp; for(i=num-1;i>0;i--) { for(j=0;j0) { temp=goods[j]; goods[j]=goods[j+1]; goods[j+1]=temp; } else continue; } } printall(goods,1); }

void change(Goods goods[50])//修改函数(号码) { int i,j; printf(\请输入要修改的编号\ scanf(\ printf(\将号码改为\

scanf(\ goods[i-00001].call=j; }

void changep(Goods goods[50])//修改函数(目的地) { int i; char j[10]; printf(\请输入要修改的编号\ scanf(\ printf(\将目的地改为\ scanf(\ strcpy(goods[i-00001].mudidi,j); }

void changet(Goods goods[50])//修改函数(送货员) { int i; char j[10]; printf(\请输入要修改的编号\ scanf(\ printf(\将送货员改为\ scanf(\ strcpy(goods[i-00001].mudidi,j); }

void main()//主函数开始 { Goods goods[50]= { {\张三\南京\赵先生\ {\李四\常州\钱先生\ {\小周\上海\孙先生\ {\小王\武汉\李先生\ {\小刘\杭州\周先生\ };//初始化五个数据 Goods x; int i=1,j=1; char NO[6]; int temp; while(i) { printf(\物流查询系统\\n\ printf(\输入并插入订单\\n\

开:\\n\

printf(\按订单号查找\\n\

printf(\删除一个订单\\n\printf(\排序(仅号码)\\n\

printf(\输出订单的信息(顺序)\\n\printf(\修改数据\\n\printf(\退出\\n\

printf(\输入项目序号:\\n\scanf(\switch (i) {

case 1: printf(\请输入要插入订单的编号、送货员、目的地、签收人、号码,用空格隔 scanf(\ insert(goods,x); printf(\插入后的数据:\\n\ printall(goods,0); printf(\ break; case 2: printf(\请输入要查找订单的编号:\ scanf(\ gets(NO); temp=find(goods,NO); if(temp==-1) printf(\!订单不存在!\ else { printf(\编号\\t名称\\t目的地\\t签收人\\t号码\\n\ print(goods,temp); } printf(\ break; case 3: printf(\请输入要删除订单的编号:\ scanf(\ gets(NO); del(goods,NO); printf(\删除后的结果:\\n\ printall(goods,0); printf(\ break; case 4: while(j)

{ printf(\排序选项:\\n\ printf(\按号码排序\\n\ printf(\返回主菜单\\n\ printf(\输入项目序号:\\n\ scanf(\ switch(j) { case 1: sortlea(goods);//按号码 break; case 0: break;//返回主菜单 default: printf(\项目不存在!\\n\ break; } } j=1; printf(\ break; case 5: sortNO(goods); printf(\ break; case 6: while(j) { printf(\改号码\\n\ printf(\改目的地\\n\ printf(\改送货员\\n\ printf(\返回主菜单\\n\ printf(\输入项目序号:\\n\ scanf(\ switch(j) { case 1:change(goods); printall(goods,0); break; case 2:changep(goods); printall(goods,0); break; case 3:changet(goods);

printall(goods,0); break; case 0:break; default:

printf(\项目不存在!\ } } case 0: break; default: printf(\项目不存在!\\n\ break; } } }

本文来源:https://www.bwwdw.com/article/8mhr.html

Top