小型超市商品销售管理系统c文档下载内容摘要:

计 class spbase {public: int t。 float oprice。 float iprice。 float prof。 int quantity。 15 char name[10]。 void getdate()。 void showdate()。 void add()。 void search()。 void remove()。 gett(){return t。 } }。 oid spbase::getdate() //输入函数的设计 { cout\n\t\t请输入商品名称 :。 cinname。 cout\n\t\t请输入商品售价 :。 cinoprice。 cout\n\t\t请输入商品进价 :。 ciniprice。 cout\n\t\t请输入商品库存量 :。 cinquantity。 } void spbase::showdate() //输出函数的设计 { cout\n\n商品基本信息如下 :。 cout\n\n\t\t商品名称 :。 coutname。 cout\n\n\t\t商品售价 :。 coutoprice。 cout\n\n\t\t商品进价 :。 coutiprice。 cout\n\n\t\t商品库存量 :。 coutquantity。 prof=(opriceiprice)*quantity。 cout\n\n\t\t商品利润为 :。 coutprof。 } void spbase::add() //添加函数的设计 { t=1。 ofstream file(,ios::out|ios::ate)。 if(!file) {cout文件打开失败。 getch()。 exit(1)。 16 } spbase p1。 ()。 (reinterpret_castchar*(amp。 p1),sizeof(spbase))。 // reinterpret_cast强制转换 ()。 } void spbase::search() //查询函数的设计 { char name4[10]。 cout\n请输入生活用品名称 :。 cinname4。 fstream file(,ios::in)。 if (!file) {cout文件打开失败。 getch()。 exit(1)。 } char flag=39。 a39。 //设标志位 spbase p1。 (reinterpret_castchar*(amp。 p1),sizeof(spbase))。 while(!()) //正确显示,指针还没到末尾继续 { if((strcmp(,name4)==0)amp。 amp。 gett()) {()。 getch()。 flag=39。 z39。 break。 } (reinterpret_castchar*(amp。 p1),sizeof(spbase))。 } if(flag!=39。 z39。 ) { cout(该商品已被删除。 )。 getch()。 } ()。 } 17 void spbase::remove() //删除函数的设计 { t=0。 search()。 } 3. 食品类设计 (food) class food:public spbase { private: char pfs[10]。 public: void getdatef() { spbase::getdate()。 cout\n\t\t请输入商品批发商 :。 cinpfs。 } void showdatef() { spbase::showdate()。 cout\n\n\t\t商品批发商 :。 coutpfs。 } void addf() { t=1。 ofstream file(,ios::out|ios::ate)。 if(!file) {cout文件打开失败。 getch()。 exit(1)。 } food f。 ()。 (reinterpret_castchar*(amp。 f),sizeof(food))。 ()。 } void searchf() { char name1[10]。 cout\n请输入食品名称 :。 cinname1。 18 fstream file(,ios::in)。 if (!file) {cout文件打开失败。 getch()。 exit(1)。 } char flag=39。 a39。 food f。 (reinterpret_castchar*(amp。 f),sizeof(food))。 while(!()) { if((strcmp(,name1)==0)amp。 amp。 gett()) {()。 getch()。 flag=39。 z39。 break。 } (reinterpret_castchar*(amp。 f),sizeof(food))。 } if(flag!=39。 z39。 ) { cout(该商品已被删除。 )。 getch()。 } ()。 } void removef() { t=0。 searchf()。 } }。 4. 化妆品类设计( makeup) class makeup:public spbase { private: char pp[10]。 public: void getdatem() { spbase::getdate()。 cout\n\t\t请输入商品品牌 :。 cinpp。 } 19 void showdatem() { spbase::showdate()。 cout\n\n\t\t商品品牌 :。 coutpp。 } void addm() { t=1。 ofstream file(,ios::out|ios::ate)。 if(!file) {cout文件打开失败。 getch()。 exit(1)。 } makeup m。 ()。 (reinterpret_castchar*(amp。 m),sizeof(makeup))。 ()。 } void searchm() { char name2[10]。 cout\n请输入化妆品名称 :。 cinname2。 fstream file(,ios::in)。 if (!file) {cout文件打开失败。 getch()。 exit(1)。 } char flag=39。 a39。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。