图书订购系统.doc_第1页
图书订购系统.doc_第2页
图书订购系统.doc_第3页
图书订购系统.doc_第4页
图书订购系统.doc_第5页
已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论