




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
/图书订购系统#include#includeusing namespace std;#includebuy.h#includebook.hconst int x=20;class orderpublic:order();void setbuyid(int b_id);void buy_one_book(string b_id);void display();private:static int ordercount;int orderID;int buyerID;int listcount;string orderlist20;order:order()buyerID=0;ordercount+;orderID=ordercount;listcount=0;void order:setbuyid(int b_id)buyerID=b_id;void order:buy_one_book(string b_id)orderlistlistcount=b_id;listcount+;void order:display()coutn订单信息nn订单号:orderIDendl购书人编号:buyerIDendl购买图书编号:endl;for(int i=0;ilistcount;i+)couttorderlistiendl;coutendl;int order:ordercount=0;int main()int buyerid,flag,j=0;book* c2;common b1(黄潮州,1,宁都,0);vip b2(肖心远,2,南昌,0.6,0);member b3(谢小汶,3,于都,5,0);order ol20;buyer* b3=&b1,&b2,&b3;book c1(C1,C+ programe,谭浩强,清华,35);book c2(C2,data structure,徐天风,北大,20);c0=&c1;c1=&c2;cout购书人信息:nn;for(int i=0;idisplay();coutn图书信息:nn;for(i=0;idisplay();while(j2)coutnnbuyerid;flag=0;for(i=0;igetid()=buyerid)flag=1;break;if(!flag)cout编号不存在!setpay(c0-getprice();bi-setpay(c1-getprice();coutendl购书人需要付费:getpay()getid();olj.buy_one_book(c0-getbook_ID();olj.buy_one_book(c1-getbook_ID();olj.display();j+;return 0;/book.hclass bookprotected:string book_ID;string book_name;string author;string publish;double price;public:book();book(string b_id,string b_n,string au,string pu,double pr);void display();string getbook_ID();string getbook_name();string getauthor();string getpublish();double getprice();book:book(string b_id,string b_n,string au,string pu,double pr)book_ID=b_id;book_name=b_n;author=au;publish=pu;price=pr;book:book()book_ID=;book_name=;author=;publish=;price=0;void book:display()cout书名:book_nameendl书号:book_IDendl作者:authorendl出版社:publishendl定价:priceendl;string book:getbook_ID()return book_ID;string book:getbook_name()return book_name;string book:getauthor()return author;string book:getpublish()return publish;double book:getprice()return price;/buy.hclass buyerprotected:string name;int buyerID;string addr;double pay;public:buyer();buyer(string n,int b,string a,double p);string getbuyername();string getaddr();double getpay();int getid();virtual void display();virtual void setpay(double=0)=0; ;class member:public buyerint leaguer_grade;public:member(string n,int b,string a,double p,int l):buyer(n,b,a,p)leaguer_grade=l;void display();void setpay(double p);class vip:public buyerdouble discount_rate;public:vip(string n,int b,string a,double p,double d):buyer(n,b,a,p)discount_rate=d;void display();void setpay(double p);class common:public buyerpublic:common(string n,int b,string a,double p):buyer(n,b,a,p)void display();void setpay(double p);buyer:buyer(string n,int b,string a,double p)name=n;buyerID=b;addr=a;pay=p;double buyer:getpay()return pay;string buyer:getaddr()return addr;string buyer:getbuyername()return name;int buyer:getid()return buyerID;void member:display()cout购书人姓名:namet购书人编号:buyerIDt购书人会员级别:leaguer_graden地址:addrnn;void member:setpay(double p)if(leaguer_grade=1)pay=0.95*p+pay;else if(leaguer_grade=2)pay=0.90*p+pay;else if(leaguer_grade=3)pay=0.85*p+pay;else if(leaguer_grade=4)pay=0.8*p+pay;else if(leaguer_grade=5)pay=0.75*p+pay;elsecout级别错误endl;void vip:display()cout购书人姓名:namet购书人编号:buyerIDtVIP折扣率:discount_rate*100%n地址:add
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年安全生产知识竞赛之机械故障排除试题及答案
- 仓储物流入职培训仓库管理与库存控制试题及答案
- 2026年水果种植公司员工薪酬管理制度
- (正式版)DB2327∕T 078-2023 《大兴安岭地区机关办公楼(区) 物业服务规范》
- 4《珍珠鸟》教学设计-统编版语文五年级上册 -
- 宠物店开店知识培训课件
- 第16课《驱遣我们的想象》教学设计-统编版语文九年级下册
- 求职家暴法律知识培训课件
- 2024-2025学年高中历史 第六单元 杰出的科学家 第3课 中国地质力学的奠基人李四光(2)教学说课稿 新人教版选修4
- 第6课 区间限速说课稿-2025-2026学年初中信息技术龙教版2018八年级下册-龙教版2018
- 食堂菜品出品管理方案
- 现网终端问题分析报告
- 中国历史时期疆域变迁
- 第十五章巷道与井筒施工测量
- GB/T 15415-1994炉用高温电视系统测量方法
- GB/T 13384-2008机电产品包装通用技术条件
- FZ/T 07019-2021针织印染面料单位产品能源消耗限额
- 《计算机辅助翻译》课程教学大纲
- 电厂化学运行规程
- 新版香港朗文1A-6B全部单词汇总
- 华南农大农业生态学
评论
0/150
提交评论