[it计算机]高级语言课程设计商品进销存管理程序内容摘要:

,GooInfo[i].Gname,GooInfo[i].Gno,GooInfo[i].Bid,GooInfo[i].Quantityin,GooInfo[i].Price,GooInfo[i].Quantityout,GooInfo[i].Stocks)。 } fclose(fpw)。 printf(\n修改成功。 \n)。 printf(\n请按 enter键返回主菜单 !\n)。 getchar()。 getchar()。 menu()。 } } 20 if(found0) { printf(\n没有找到该商品号的记录 :\n)。 printf(\n请按 enter键返回主菜单 !\n)。 getchar()。 getchar()。 menu()。 } } . quiry void quiry() //查看信息 { int chose。 int right。 do { system(cls)。 printf(\n\t1按商品号查询 \t2按商品名查询 \t3返回 \n)。 printf(\n请 输入数字选择 :)。 scanf(%d,amp。 chose)。 if(chose1||chose3) { right=1。 getchar()。 } else right=0。 }while(right==1)。 switch(chose) 21 { case 1:byGno()。 break。 case 2:byGname()。 break。 case 3:menu()。 } } void byGno() //通过商品号查看信息 { int found=1。 int num。 int i。 char no[20]。 FILE*fp。 if((fp=fopen(,r))==NULL) { printf(文件打不开。 \n)。 menu()。 } for(i=0。 !feof(fp)。 i++) //读取文件 { fscanf(fp,%s%s%f%d%f%d%d,amp。 GooInfo[i].Gname,amp。 GooInfo[i].Gno,amp。 GooInfo[i].Bid,amp。 GooInfo[i].Quantityin,amp。 GooInfo[i].Price,amp。 GooInfo[i].Quantityout, amp。 GooInfo[i].Stocks)。 } num=i。 fclose(fp)。 printf(\n请输入商品编号 :)。 scanf(%s,no)。 for(i=0。 inum。 i++) 22 { if(strcmp(no,GooInfo[i].Gno)==0) { found=i。 printf(\n该商品的信息为: \n\n)。 printf(商品名 商品号 进价 进货量 售价 销售量 库存量 \n)。 printf(%s\t%s\t%.2f\t%d\t%.2f\t%d\t%d\n,GooInfo[found].Gname,GooInfo[found].Gno,GooInfo[found].Bid,GooInfo[found].Quantityin,GooInfo[found].Price,GooInfo[found].Quantityout,GooInfo[found].Stocks)。 } } if(found0) printf(\n没有找到该商品号的记录 !\n)。 printf(\n请按 enter键返回上级菜单 !\n)。 getchar()。 getchar()。 quiry()。 } void byGname() //通过商品名查看信息 { int found=1。 int num。 int i。 char name[20]。 FILE*fp。 if((fp=fopen(,r))==NULL) 23 { printf(文件打不开。 \n)。 menu()。 } for(i=0。 !feof(fp)。 i++) //读取文件 { fscanf(fp,%s%s%f%d%f%d%d,amp。 GooInfo[i].Gname,amp。 GooInfo[i].Gno,amp。 GooInfo[i].Bid,amp。 GooInfo[i].Quantityin,amp。 GooInfo[i].Price,amp。 GooInfo[i].Quantityout,amp。 GooInfo[i].Stocks)。 } num=i。 fclose(fp)。 printf(\n请输入商品名 :)。 scanf(%s,name)。 printf(\n叫该商品名的商品信息为: \n\n)。 printf(商品名 商品号 进价 进货量 售价 销售量 库存量 \n)。 for(i=0。 inum。 i++) { if(strcmp(name,GooInfo[i].Gname)==0) { found=i。 printf(%s\t%s\t%.2f\t%d\t%.2f\t%d\t%d\n,GooInfo[found].Gname,GooInfo[found].Gno,GooInfo[found].Bid,GooInfo[found].Quantityin,GooInfo[found].Price,GooInfo[found].Quantityout,GooInfo[found].Stocks)。 } } if(found0) printf(\n没有找到该商品名的记录 !\n)。 24 printf(\n请按 enter键返回上级菜单 !\n)。 getchar()。 getchar()。 quiry()。 } . stastic void stastic() //统计功能 { int chose。 int right。 do { system(cls)。 printf(\n\t1总销售额 \t2总进货额 \t3返回 \n)。 printf(\n请输入数字选择 :)。 scanf(%d,amp。 chose)。 if(chose1||chose3) { right=1。 getchar()。 } else right=0。 }while(right==1)。 switch(chose) { case 1: Out()。 printf(\n请按 enter键返回上级菜单 !\n)。 25 getchar()。 getchar()。 stastic()。 break。 case 2: In()。 printf(\n请按 enter键返回上级菜单 !\n)。 getchar()。 getchar()。 stastic()。 break。 case 3:menu()。 } } void Out() //销售额 { float num。 num=OutNum()。 printf(\n总销售额为: %.2f\n,num)。 } float OutNum() //销售额 { int num。 int found。 float pq=0。 26 int i。 FILE*fp。 if((fp=fopen(,r))==NULL) { printf(文件打不开。 \n)。 menu()。 } for(i=0。 !feof(fp)。 i++) //读取文件 { fscanf(fp,%s%s%f%d%f%d%d,amp。 GooInfo[i].Gname,amp。 GooInfo[i].Gno,amp。 GooInfo[i].Bid,amp。 GooInfo[i].Quantityin,amp。 GooInfo[i].Price,amp。 GooInfo[i].Quantityout,amp。 GooInfo[i].Stocks)。 } fclose(fp)。 num=i。 for(i=0。 inum。 i++) { found=i。 pq+=GooInfo[i].Quantityout*GooInfo[i].Price。 } return pq。 } void In() //进货额 { float num。 num=InNum()。 printf(\n总进货额: %.2f\n,num)。 27 } float InNum() //总进货额 { int num。 int found。 float bq=0。 int i。 FILE*fp。 if((fp=fopen(,r))==NULL) { printf(文件打不开。 \n)。 menu()。 } for(i=0。 !feof(fp)。 i++) //读取文件 { fscanf(fp,%s%s%f%d%f%d%d,amp。 GooInfo[i].Gname,amp。 GooInfo[i].Gno,amp。 GooInfo[i].Bid,amp。 GooInfo[i].Quantityin,amp。 GooInfo[i].Price,amp。 GooInfo[i].Quantityout,amp。 GooInfo[i].Stocks)。 } fclose(fp)。 num=i。 for(i=0。 inum。 i++) { found=i。 bq+=GooInfo[i].Quantityin*GooInfo[i].Bid。 } return bq。 28 } . Delete void Delete() //删除信息 { int num。 int i。 int found=1。 char GooNO[20]。 FILE*fpr,*fpw。 if((fpr=fopen(,r))==NULL) { printf(文件打不开。 \n)。 menu()。 } for(i=0。 !feof(fpr)。 i++) //读取文件 { fscanf(fpr,%s%s%f%d%f%d%d,amp。 GooInfo[i].Gname,amp。 GooInfo[i].Gno,amp。 GooInfo[i].Bid,amp。 GooInfo[i].Quantityin,amp。 GooInfo[i].Price,amp。 GooInfo[i].Quantityout,amp。 GooInfo[i].Stocks)。 } num=i。 fclose(fpr)。 printf(\n请输入商品号选择你要删除的记录 :)。 scanf(%s,GooNO)。 for(i=0。 inum。 i++) { if(strcmp(GooNO,GooInfo[i].Gno)==0)。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。