資源描述:
《超市管理系統(tǒng)源程序.doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、超市管理系統(tǒng)源程序#include#include#defineMAX20#defineN3#definePAGE2#definePRINT1printf("---------------------")#definePRINT2printf("商品號(hào)--商品名稱(chēng)--商品種類(lèi)--銷(xiāo)售價(jià)格--生產(chǎn)日期(年-月-日)--保質(zhì)期")#definePRINT3printf("%4d%s%s%8d%15%-%2d-%2d%10d",goods[i].num,goods
2、[i].name,goods[i].kind,goods[i].out_price,goods[i].pro_time.year,goods[i].pro_time.month,goods[i].pro_time.date,goods[i].save_day)intsum;/*記錄商品數(shù)目*/structdate/*日期結(jié)構(gòu)體類(lèi)型*/{intyear;intmonth;intdate;}structgoods_type/*商品結(jié)構(gòu)體類(lèi)型*/{intsum;charname[10];charkind[10];
3、intamount;intgoods_up;intgoods_down;intin_price;intout_price;intin_num;structdatein_time;structdatepro_time;charfactory[10];intsave_day;intprofit;}goods[MAX];/*存放MAX種商品記錄的結(jié)構(gòu)體數(shù)據(jù)*/save_message(jinsum)/*保存信息*/{FILE*fp;inti;if((fp=fopen("supermarket.txt","wb")
4、)==NULL){printf("讀文件錯(cuò)誤!");return;}for(i=0;i5、{printf("第%d種商品",i+1);printf("商品號(hào):");scanf("%d",&goods[i].num);if(goods[i].num==0)break;printf("商品名稱(chēng):");scanf("%s",goods[i].name);printf("商品類(lèi)別:");scanf("%s",goods[i].kind);printf("商品總量:");scanf("%s",&goods[i].amout);printf("商品上限:");scanf("%s",&
6、goods[i].goods_up);printf("商品下限:");scanf("%s",&goods[i].goods_down);printf("進(jìn)貨價(jià)格:");scanf("%s",&goods[i].in_price);printf("銷(xiāo)售價(jià)格:");scanf("%s",&goods[i].out_price);printf("進(jìn)貨數(shù)量:");scanf("%s",&goods[i].in_num);printf("進(jìn)貨日期(yyyy-mm-dd):");scanf("%d-
7、%d-%d",&goods[i].in_time.year,&goods[i].in_time.month,&goods[i].in_time.date);printf("商品名稱(chēng):");printf("生產(chǎn)日期(yyyy-mm-dd):");scanf("%d-%d-%d",&goods[i].pro_time.year,&goods[i].pro_time.month,&goods[i].pro_time.date);printf("生產(chǎn)廠家:");scanf("%s",goods[i].f
8、actory);printf("保質(zhì)期:");scanf("%s",goods[i].save_day);i++;}while(i