c语言超市商品管理系统内容摘要:
p=fopen(goods ,w))==NULL) /*判断能否打开文件*/ { printf(can not open the file)。 exit(0)。 /*结束程序 */ } p3=head。 while(p3!=NULL) /*判断循环结束条件 */ { fprintf(fp,%d %s %s %f %s %d ,p3num,p3name,p3kind,p3price,p3unit,p3quantity)。 /*将商品信息写入文件 */ p3=p3next。 } fprintf(fp,%d,1)。 fclose(fp)。 /*关闭文件 */ } if(r==2) continue。 /*继续循环 */ printf(**********************************\n)。 printf(__________________________________\n)。 printf(请按 4 返回 \n)。 printf(__________________________________\n)。 printf(**********************************\n)。 } 商品信息修改 if(n==3) /*修 改某商品信息 */ { printf(请输入需要修改的商品编号 \n)。 scanf(%d,amp。 q)。 while(p3!=NULL) /*判断循环结束条件 */ { if((p3num)==q) /*判断是否为所需要修改的商品 */ { printf(请输入商品单价与库存量(如果单价不变请输入原来的单价) \n)。 scanf(%f %d,amp。 p3price,amp。 p3quantity)。 /*输入商品价格与库存量 */ } p3=p3next。 } if((fp=fopen(goods ,w))==NULL) /*判断能否打开文件 */ { printf(can not open the file)。 exit(0)。 /*结束程序 */ } p3=head。 while(p3!=NULL) /*判断循环结束条件 */ { fprintf(fp,%d %s %s %f %s %d ,p3num,p3name,p3kind,p3price,p3unit,p3quantity)。 /*将商品信息写入文件 */ p3=p3next。 } fprintf(fp,%d,1)。 fclose(fp)。 /*关闭文件 */ printf(**********************************\n)。 printf(__________________________________\n)。 printf(请按 4 返回 \n)。 printf(__________________________________\n)。 printf(**********************************\n)。 } if(n==4) /*退出 */ break。 } printf(**********\n)。 printf(1 继续修改 \n\n2 返回 \n)。 printf(**********\n)。 scanf(%d,amp。 p)。 if(p==1) continue。 /*继续循环 */ if(p==2) break。 /*跳出循环 */ }while(n!=2)。 fclose(fp)。 /*关闭文件 */ } 商品信息统计 void printf0(struct good *p) /*遍历链表并打印电器类商品函数 */ { struct good *p3。 /*定义结构体指针类型 */ p3=p。 while (p3!=NULL) /*判断遍历链表循环结束条件 */ { if(strcmp(p3kind,c)==0) /*判断商品类型是否为电器类型 */ { printf(%d\t%s\t%s\t%\t%s\t%d\n,p3num,p3name,p3kind,p3price,p3unit,p3quantity)。 /*输出电器类商品信息 */ printf(________________________________________________\n)。 } p3=p3next。 } return。 } void printf1(struct good *p) /*遍历链表并打印日用品类商品函数 */ { struct good *p3。 /*定义结构体指针类型 */ p3=p。 while (p3!=NULL) /*判断遍历链表循环结束条件 */ { if(strcmp(p3kind,d)==0) /*判断商品类型是否为日用品类型 */ { printf(%d\t%s\t%s\t%\t%s\t%d\n,p3num,p3name,p3kind,p3price,p3unit,p3quantity)。 /*输出日用品类商品信息 */ printf(________________________________________________\n)。 } p3=p3next。 } return。 } void printf2(struct good *p) /*遍历链表并打印办公用品类商品函数 */ { struct good *p3。 /*定义结构体指针类型 */ p3=p。 while (p3!=NULL) /*判 断遍历链表循环结束条件 */ { if(strcmp(p3kind,e)==0) /*判断商品类型是否为办公用品类型 */ { printf(%d\t%s\t%s\t%\t%s\t%d\n,p3num,p3name,p3kind,p3price,p3unit,p3quantity)。 /*输出办公用品类商品信息 */ printf(________________________________________________\n)。 } p3=p3next。 } return。 } void printf3(struct good *p) /*遍历链表并打印食品类商品函数 */ { struct good *p3。 /*定义结构体指针类型 */ p3=p。 while (p3!=NULL) /*判断遍历链表循环结束条件 */ { if(strcmp(p3kind,f)==0) /*判断商品类型是否为食品类型 */ { printf(%d\t%s\t%s\t%\t%s\t%d\n,p3num,p3name,p3kind,p3price,p3unit,p3quantity)。 /*输出食品类商品信息 */ printf(________________________________________________\n)。 } p3=p3next。 } return。 } void shunxudayin() { for(i=0。 i4。 i++) g[i]=aver[i]。 /*将平均价赋给新数组 */ for(j=0。 j3。 j++) /*将新数组用冒泡排序法排序 */ for(i=j+1。 i4。 i++) { if(g[j]g[i]) { h=g[j]。 g[j]=g[i]。 g[i]=h。 } } printf(\n****************************\n)。 printf(商品平均价格排序表(从高到低) \n)。 printf(****************************\n)。 printf(________________________________________________\n)。 printf(编号 \t 名称 \t 类别 \t 单价 \t 单位 \t 数量 \n)。 printf(________________________________________________\n)。 for(j=0。 j4。 j++) for(i=0。 i4。 i++) { if (aver[i]==g[j]) /*判断每类商品平均价格的先后顺序 */ switch(i) { case 0: printf0(head)。 /*调用遍历链表并打印电器类商品函数 */ break。 case 1: printf1(head)。 /*调用遍历链表并打印日用品类商品函数 */ break。 case 2: printf2(head)。 /*调用遍历链表并打印办公用品类商品函数 */ break。 case 3: printf3(head)。 /*调用遍历链表并打印食品类商品函数 */ break。 } } } void tongji1() { p1=head。 printf(\n************************\n)。 printf(库存量低于 100 的货名及类别 \n)。 printf(************************\n)。 printf(________________________\n)。 printf(商品名称 \t 商品类型 \n)。 printf(________________________\n)。 while(p1!=NULL) /*判断遍历链表循环结束条件 */ { if(p1quantity100) /*判断库存量是否小于 100*/ { printf(%s\t%s\n,p1name,p1kind)。 /*输出商品名称及类别 */ printf(________________________\n)。 } p1=p1next。 } } void tongji2() { printf(\n**********************************************\n)。 printf(商品库存量有 2 种以上(含 2 种)低于 100 的商品类别 :\n)。 printf(**********************************************\n)。 printf(________\n)。 if((a[0]100)amp。 amp。 (a[0]=2)) /*判断电器类库存量是否为 2 种以上(含 2 种)低于 100*/ { printf(电器 \n)。 printf(________\n)。 } if((a[1]100)amp。 amp。 (a[1]=2)) /*判断日用品类库存量是否为 2 种以上(含 2 种)低于 100*/ {。c语言超市商品管理系统
本资源仅提供20页预览,下载后可查看全文
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。
用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。
相关推荐
h20xx032078_基于net订单管理系统的开发
数据。 DBMS 引擎还涉及事务管理、锁、备份和恢复。 2 信息管理系统论述 管理信息系统 (简称 MIS)是介于信息论,经济管理理论,统计学与运筹学及 计算机科学之间的一门边缘性,综合性,系统性的交叉科学,它是随着管理科学, 信息技术,计算机技术等的发展而产生和发展起来的。 企业订单管理系统是典型的信息管理系统,其开发主要包括后台数据 库的建 立和维护以及前端的应用程序的开发两个方面。
dell公司客户关系管理案例论文正文
和分析能力的同时 ,添加新功能模块 ,才逐步形成了我们今天所熟知的 CRM,这是 CRM 的第三个阶段。 当然特别是 GartnerGroup 正式提出 CRM 的概念以后 ,又一次加速了 CRM 的具体定型和发展。 客户关系管理的作用 ( 1)提高市场营销效果 企业通过客户关系管理的营销模块,对市场营销活动加以计划、执行、监视、分析;通过调用企业外部的电信、媒体、中介机构、政府等资源,