




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、 成績: 課 程 設(shè) 計設(shè)計課程名稱: 面向?qū)ο蟪绦蛟O(shè)計C+ 題 目: 模擬網(wǎng)上購書的結(jié)賬功能 學(xué) 號: 學(xué) 生 姓 名 : 專 業(yè) 班 級: 指 導(dǎo) 教 師: 設(shè)計時間: 年 月 日 年 月 日模擬網(wǎng)上購書的結(jié)帳功能一、 課程設(shè)計目的本課程設(shè)計是計算機專業(yè)重要的實踐性環(huán)節(jié)之一,是在學(xué)習(xí)完面向?qū)ο蟪绦蛟O(shè)計語言(C+)課程后進行的一次全面的綜合練習(xí)。本課程設(shè)計的目的和任務(wù):1. 鞏固和加深學(xué)生對C+語言課程的基本知識的理解和掌握2. 掌握C+語言編程和程序調(diào)試的基本技能3. 利用C+語言進行面向?qū)ο蟮能浖O(shè)計方法4. 掌握書寫程序設(shè)計說明文檔的能力5. 提高運用C+語言解決實際問題的能力二、 需
2、求分析用C+語言完成一個模擬網(wǎng)上購書結(jié)賬功能,數(shù)據(jù)保存在文件中。C+語言全面兼容C語言,它比C語言更加安全、可讀性更好、代碼結(jié)構(gòu)更合理。所以C+是的該程序開發(fā)更加容易。模擬網(wǎng)上購書結(jié)賬功能可以方便賣書人員更加快速地獲取并充分了解自己銷售書籍的訂單信息,十分有用。模擬網(wǎng)上購書系統(tǒng)需要實現(xiàn)的功能:(1)發(fā)票信息錄入;(2)發(fā)票信息刪除;(3)根據(jù)發(fā)票號查詢發(fā)票信息;(4)根據(jù)買家ID查詢發(fā)票信息;(5)顯示所有發(fā)票信息。 三、 總體設(shè)計1. 模擬網(wǎng)上購書系統(tǒng)功能總體設(shè)計如下:模擬網(wǎng)上購書系統(tǒng)顯示所有發(fā)票信息根據(jù)買家ID查詢發(fā)票信息根據(jù)發(fā)票號查詢發(fā)票信息發(fā)票信息刪除發(fā)票信息錄入圖3.1 功能模塊圖2
3、. 數(shù)據(jù)存儲在文件中 1)Book.txt:存儲書籍信息,包括書籍編號、書名、作者、出版社、單價; 2)Buyer.txt:存儲購書者信息,包括買家ID、姓名、地址、身份(0代表普通人,1代表會員,2代表貴賓); 3)Orde.txt:存儲訂單信息,包括訂單號、買家ID; 4)Receipt.txt:存儲發(fā)票信息,包括訂單號、書籍編號、數(shù)量;3.開發(fā)軟件:Visual Studio 20104.操作系統(tǒng):windows 7四、 各功能設(shè)計1、在類Book中主要定義了,書籍的編號、書名、作者、出版社、和價格。還定義了書籍信息的顯示函數(shù)class Bookpublic:Book();Book(st
4、ring bi, string bn, string au, string pu, double pr);/構(gòu)造函數(shù)void display();/顯示函數(shù)private:string bookID;/編號string bookName;/書名string author;/作者string publish;/出版社double price;/價格;2、在Buyer.h中主要定義了Buyer這個基類,并對它進行派生,共3個派生類:People、Member和Vipclass Buyerpublic:Buyer();Buyer(string id,string na,string ad);/構(gòu)造函
5、數(shù)virtual void display();/顯示函數(shù)(虛函數(shù))protected:string buyerID; /買家IDstring name; /姓名string address;/地址;/普通人類class People:public Buyerpublic:People(string id,string na,string ad):Buyer(id,na,ad)void display();/會員類class Member:public Buyerpublic:Member(string id,string na,string ad,double dc):Buyer(id,na
6、,ad)discount_member=dc;void display();private:double discount_member;/折扣率;/貴賓類class Vip:public Buyerpublic:Vip(string id,string na,string ad,double dc):Buyer(id,na,ad)discount_vip=dc;void display();private:double discount_vip;/折扣率; 3、在Order中主要定義了訂單的發(fā)票號和買家ID兩個屬性。還定義了添加訂單信息、刪除訂單信息等函數(shù)。class Orderpublic
7、:Order();Order(int re,string bu);/構(gòu)造函數(shù)int getLine();/獲取Order.txt中的行數(shù)void readOrder(Order o);/從Order.txt中讀取數(shù)據(jù)放入Receipt對象數(shù)組中int Judge(int receiptID);/判斷Order.txt中是否存在該訂單號,若存在返回該訂單的行號,不存在返回-1void addOrder(int receiptID,string buyerID);/添加訂單信息void deleteOrder(int receiptID);/刪除訂單信息private:int receiptID;
8、/發(fā)票號string buyerID;/買家ID;4、在Receipt中主要定義了發(fā)票的訂單號、書籍編號、數(shù)量、總價等屬性。還定義了添加刪除發(fā)票信息、查找發(fā)票、顯示發(fā)票等函數(shù)。class Receiptpublic:Receipt();Receipt(int re,string bo,int nu);/構(gòu)造函數(shù)int getBookLine();/獲取Book.txt中的行數(shù)void readBook(string bookID, string bookName, string author, string publish, string price);/從Book.txt中讀取數(shù)據(jù)放入數(shù)組中
9、int getBuyerLine();/獲取Buyer.txt的行數(shù)void readBuyer(string buyerID, string name, string address,string type);/從Buyer.txt中讀取數(shù)據(jù)放入數(shù)組中void readOrder(string receiptID,string buyerIDs);/從Order.txt中,讀取數(shù)據(jù),放入數(shù)組中int getReceiptLine();/獲取Receipt.txt的行數(shù)void readReceipt(Receipt receipt);/從Receipt.txt中讀取數(shù)據(jù)放入Receipt對象
10、數(shù)組中returnLs Judge(int receiptID);/判斷Receipt.txt中是否存在用戶要求的發(fā)票編號,如果存在,返回行號數(shù)組類void addReceipt();/添加發(fā)票void deleteReceipt();/刪除發(fā)票void selectReceiptByRI();/根據(jù)訂單號查找發(fā)票void selectReceiptByBI();/更具買家ID查找發(fā)票void print();/打印發(fā)票private:int receiptID;/發(fā)票編號string bookID;/圖書編號int num;/購書數(shù)量double pay;/支付總金額;五、 系統(tǒng)實現(xiàn)與系統(tǒng)調(diào)
11、試1、登入模擬網(wǎng)上購書系統(tǒng),看到歡迎界面,用戶可根據(jù)主界面提示的操作,輸入1-5任一編號,選擇所需操作。 2、發(fā)票信息錄入,先輸入買家ID,再輸入所需的書籍編號和數(shù)量(可輸入多本書籍編號和數(shù)量,輸入書籍編號為0時停止錄入),錄入完成可選擇再錄入信息或返回上級目錄或退出。3、輸入發(fā)票號,選擇刪除訂單。若存在訂單號,則顯示刪除成功;若不存在顯示數(shù)據(jù)庫中沒有此訂單,完成該操作可選擇再刪除信息或返回上級目錄或退出。4、根據(jù)發(fā)票號查找發(fā)票信息,用戶輸入發(fā)票號,若存在該發(fā)票號則顯示發(fā)票信息,若不存在顯示不存在該訂單。操作完成后可選擇繼續(xù)查詢發(fā)票信息或返回上級目錄,或退出。5、根據(jù)買家ID查找發(fā)票信息,用戶
12、輸入買家ID,若存在顯示該買家的所有發(fā)票信息;6、若不存在顯示該賣家沒有。操作完成后可選擇繼續(xù)查詢發(fā)票信息或返回上級目錄,或退出。7、打印所有發(fā)票信息,操作結(jié)束后可選擇返回上級目錄或退出系統(tǒng)。六、 軟件使用說明1、 登入模擬網(wǎng)上購書系統(tǒng),看到歡迎界面,用戶可根據(jù)主界面提示的操作,輸入1-5任一編號(輸入0,退出),選擇所需操作。2、 輸入1,可進行發(fā)票信息錄入錄入。先輸入買家ID,再輸入所需的書籍編號和數(shù)量(可輸入多本書籍編號和數(shù)量,輸入書籍編號為0時停止錄入),錄入完成可輸入1選擇再錄入信息,輸入2返回上級目錄,輸入0退出。3、 輸入2,可進行發(fā)票號信息刪除。輸入發(fā)票號,若存在訂單號,則顯示
13、刪除成功;若不存在顯示數(shù)據(jù)庫中沒有此訂單,完成該操作可輸入1選擇再刪除發(fā)票信息,輸入2返回上級目錄,輸入0退出。4、 輸入3,可進行根據(jù)發(fā)票號查找發(fā)票信息。輸入發(fā)票號,若存在該發(fā)票號則顯示發(fā)票信息,若不存在顯示不存在該訂單。操作完成后可輸入1選擇根據(jù)發(fā)票號查找發(fā)票信息,輸入2選擇根據(jù)買家ID查找發(fā)票信息,輸入3返回上級目錄,輸入0退出。5、 輸入4,可進行根據(jù)買家ID查找發(fā)票信息。輸入買家ID,若存在顯示買家所有發(fā)票信息,若不存在買家沒有訂單。操作完成后可輸入1選擇根據(jù)發(fā)票號查找發(fā)票信息,輸入2選擇根據(jù)買家ID查找發(fā)票信息,輸入3返回上級目錄,輸入0退出。七、 課程設(shè)計心得與體會這次實訓(xùn)讓我對
14、本學(xué)期所學(xué)的C+進行有了更深一步的了解,并可以使用C+初步完成一個簡單的系統(tǒng)。訓(xùn)練了我綜合運用所學(xué)習(xí)的各項知識,完成此系統(tǒng)的操作。實訓(xùn)過程中,我遇到了很多問題,例如C+中string和int類型之間的轉(zhuǎn)換,如何返回int數(shù)組等問題,但通過上網(wǎng)搜索或詢問老師同學(xué)以后都得到了解決,也掌握了這些方法。在設(shè)計網(wǎng)上模擬購書系統(tǒng)的過程中,我使用的是文件存儲數(shù)據(jù),所以在調(diào)用的時候要考慮很多循環(huán)和關(guān)聯(lián),這鍛煉了我的思維模式。這些都讓我獲益匪淺。在這個過程中,我進一步鞏固了所學(xué)習(xí)的知識,同時了解到自己還有很多沒學(xué)到的知識,學(xué)無止境,在以后的日子中,我一定的更加嚴(yán)格要求自己,積極進取,奮發(fā)向上,不斷努力發(fā)展自己。
15、這次的系統(tǒng)設(shè)計讓我學(xué)會了綜合運用C+所學(xué)的知識,對我今后對使用C+語言編程開發(fā)有著重要的作用。附錄1.Book.h#pragma once#include<iostream>#include<string>using namespace std;class Bookpublic:Book();Book(string bi, string bn, string au, string pu, double pr);/構(gòu)造函數(shù)void display();/顯示函數(shù)private:string bookID;/編號string bookName;/書名string autho
16、r;/作者string publish;/出版社double price;/價格;2. Book.cpp#include "Book.h"#include <iostream>#include <iomanip>#include <fstream>#include <string>using namespace std;Book:Book()bookID=""bookName=""author=""publish=""price=0;Book:Bo
17、ok(string bi, string bn, string au, string pu, double pr)bookID=bi;bookName=bn;author=au;publish=pu;price=pr;void Book:display()cout<<"書號:"<<bookID<<"t"cout<<"書名:"<<bookName<<"t"cout<<"作者:"<<author<&
18、lt;"t"cout<<"出版社:"<<publish<<"t"cout<<"價格:"<<price<<"t"3.Buyer.h#pragma once#include<string>using namespace std;/購書者類class Buyerpublic:Buyer();Buyer(string id,string na,string ad);/構(gòu)造函數(shù)virtual void display();
19、/顯示函數(shù)(虛函數(shù))protected:string buyerID;/買家IDstring name;/姓名string address;/地址;/普通人類class People:public Buyerpublic:People(string id,string na,string ad):Buyer(id,na,ad)void display();/會員類class Member:public Buyerpublic:Member(string id,string na,string ad,double dc):Buyer(id,na,ad)discount_member=dc;voi
20、d display();private:double discount_member;/折扣率;/貴賓類class Vip:public Buyerpublic:Vip(string id,string na,string ad,double dc):Buyer(id,na,ad)discount_vip=dc;void display();private:double discount_vip;/折扣率; 4. Buyer.cpp#include "Buyer.h"#include <iostream>#include <iomanip>#incl
21、ude <fstream>#include <string>using namespace std;Buyer:Buyer()buyerID=""name=""address=""Buyer:Buyer(string id,string na,string ad)name=na;buyerID=id;address=ad;int getLine()ifstream in("Buyer.txt");string line;int n=0;while(getline(in,line)n+;in.
22、close();return n;void Buyer:display()cout<<"買家信息:"cout<<"ID:"<<buyerID<<"t"cout<<"姓名:"<<name<<"t"cout<<"地址:"<<address<<"n"void People:display()Buyer:display();cout<<
23、;"該買家是普通人,無折扣率。"<<"n"void Member:display()Buyer:display();cout<<"該買家是會員,折扣率為 "<<discount_member*10<<"折!n"void Vip:display()Buyer:display();cout<<"該買家是貴賓,折扣率為 "<<discount_vip*10<<"折!n"5. Buyer.cpp#in
24、clude "Buyer.h"#include <iostream>#include <iomanip>#include <fstream>#include <string>using namespace std;Buyer:Buyer()buyerID=""name=""address=""Buyer:Buyer(string id,string na,string ad)name=na;buyerID=id;address=ad;int getLine()ifst
25、ream in("Buyer.txt");string line;int n=0;while(getline(in,line)n+;in.close();return n;void Buyer:display()cout<<"買家信息:"cout<<"ID:"<<buyerID<<"t"cout<<"姓名:"<<name<<"t"cout<<"地址:"<&
26、lt;address<<"n"void People:display()Buyer:display();cout<<"該買家是普通人,無折扣率。"<<"n"void Member:display()Buyer:display();cout<<"該買家是會員,折扣率為 "<<discount_member*10<<"折!n"void Vip:display()Buyer:display();cout<<"
27、該買家是貴賓,折扣率為 "<<discount_vip*10<<"折!n"6. Orde.h#pragma once#include<iostream>using namespace std;class Orderpublic:Order();Order(int re,string bu);/構(gòu)造函數(shù)int getLine();/獲取Order.txt中的行數(shù)void readOrder(Order o);/從Order.txt中讀取數(shù)據(jù)放入Receipt對象數(shù)組中int Judge(int receiptID);/判斷Orde
28、r.txt中是否存在該訂單號,若存在返回該訂單的行號,不存在返回-1void addOrder(int receiptID,string buyerID);/添加訂單信息void deleteOrder(int receiptID);/刪除訂單信息private:int receiptID;/發(fā)票編號string buyerID;/會員編號;7. Orde.cpp#include "Order.h"#include <iostream>#include <iomanip>#include <fstream>#include <str
29、ing>Order:Order()receiptID=0;buyerID=""/構(gòu)造函數(shù)Order:Order(int re,string bu)re=receiptID;bu=buyerID;/獲取Order.txt中的行數(shù)int Order:getLine()ifstream in("Order.txt");string line;int n=0;while(getline(in,line)n+;in.close();return n;/從Order.txt中讀取數(shù)據(jù)放入Receipt對象數(shù)組中void Order:readOrder(Orde
30、r o)ifstream infile("Order.txt",ios:in|ios:binary);if(!infile)cerr<<" open error"<<endl;exit(1);int n=getLine();for(int i=0;i<n;i+) /只讀取存放在數(shù)組中 但不對其進行相關(guān)操作string re,bu;infile>>re>>bu;int re2=atoi(re.c_str();oi.receiptID=re2;oi.buyerID=bu;infile.close();/判
31、斷Order.txt中是否存在該訂單號,若存在返回該訂單的行號,不存在返回-1int Order:Judge(int receiptID)Order order50;readOrder(order);/調(diào)用Read()函數(shù),獲取數(shù)據(jù),以便等下進行相關(guān)數(shù)據(jù)的判斷int n=getLine();for(int i=0; i<n; i+)if(receiptID = orderi.receiptID)return i;/如果存在,返回其下標(biāo)break;return -1;/否則,返回-1/添加訂單void Order:addOrder(int re,string bu)ofstream out
32、file("Order.txt",ios:app);if(!outfile) cerr<<" open error"<<endl; exit(1); outfile<<re<<"t"outfile<<bu<<"n"outfile.close();/刪除訂單void Order:deleteOrder(int receiptID)Order order50;readOrder(order);/定義一個l來接收Judge()的返回值,等下用來判斷該
33、num是否存在int l = Judge(receiptID);/如果l不等于-1, 表示要刪除的訂單信息存在if(l!=-1)int n=getLine();ofstream outfile("Order.txt");if(!outfile)cerr<<" open error"<<endl; exit(1); for(int i=0; i<n; i+)/把下標(biāo)不等于l(即除了要刪的訂單信息外)其余的數(shù)據(jù)重新寫入磁盤保存if(i != l)outfile<<orderi.receiptID<<&qu
34、ot;t"outfile<<orderi.buyerID<<endl;outfile.close();8. receipt.h#pragma once#include <iostream>#include <string>using namespace std;/行號類,存放一個int數(shù)組class returnLspublic:int l50;/發(fā)票類class Receiptpublic:Receipt();Receipt(int re,string bo,int nu);/構(gòu)造函數(shù)int getBookLine();/獲取Book
35、.txt中的行數(shù)void readBook(string bookID, string bookName, string author, string publish, string price);/從Book.txt中讀取數(shù)據(jù)放入數(shù)組中int getBuyerLine();/獲取Buyer.txt的行數(shù)void readBuyer(string buyerID, string name, string address,string type);/從Buyer.txt中讀取數(shù)據(jù)放入數(shù)組中void readOrder(string receiptID,string buyerIDs);/從Ord
36、er.txt中,讀取數(shù)據(jù),放入數(shù)組中int getReceiptLine();/獲取Receipt.txt的行數(shù)void readReceipt(Receipt receipt);/從Receipt.txt中讀取數(shù)據(jù)放入Receipt對象數(shù)組中returnLs Judge(int receiptID);/判斷Receipt.txt中是否存在用戶要求的發(fā)票編號,如果存在,返回行號數(shù)組類void addReceipt();/添加發(fā)票void deleteReceipt();/刪除發(fā)票void selectReceiptByRI();/根據(jù)訂單號查找發(fā)票void selectReceiptByBI(
37、);/更具買家ID查找發(fā)票void print();/打印發(fā)票private:int receiptID;/發(fā)票編號string bookID;/圖書編號int num;/購書數(shù)量double pay;/支付總金額;9. Receipt.cpp#include "Receipt.h"#include <iostream>#include <iomanip>#include <fstream>#include <string>#include "Book.h"#include "Buyer.h&qu
38、ot;#include "Order.h"using namespace std;const int MAX = 50;Receipt:Receipt()receiptID=0;pay=0;/支付總金額/構(gòu)造函數(shù)Receipt:Receipt(int re,string bo,int nu)receiptID=re;bookID=bo;num=nu;/獲取Book.txt的行數(shù)intReceipt:getBookLine()ifstream in("Book.txt");string line;int n=0;while(getline(in,line)
39、n+;in.close();return n;/從Book.txt中讀取數(shù)據(jù)放入數(shù)組中void Receipt:readBook(string bookID, string bookName, string author, string publish, string price)ifstream infile("Book.txt",ios:in);if(!infile)cerr<<" open error"<<endl;exit(1);for(int i=0; i<5; i+)infile>>bookIDi&g
40、t;>bookNamei>>authori>>publishi>>pricei;/只讀取存放在數(shù)組中 但不對其進行相關(guān)操作infile.close();/獲取Buyer.txt的行數(shù)int Receipt:getBuyerLine()ifstream in("Buyer.txt");string line;int n=0;while(getline(in,line)n+;in.close();return n;/從Buyer.txt中讀取數(shù)據(jù)放入數(shù)組中void Receipt:readBuyer(string buyerID, st
41、ring name, string address,string type)ifstream infile("Buyer.txt",ios:in|ios:binary);if(!infile)cerr<<" open error"<<endl;exit(1);for(int i=0; i<5; i+)infile>>buyerIDi>>namei>>addressi>>typei;/只讀取存放在數(shù)組中 但不對其進行相關(guān)操作infile.close();/從Order.txt中,
42、讀取數(shù)據(jù),放入數(shù)組中void Receipt:readOrder(string receiptId,string buyerIDs)ifstream infile("Order.txt",ios:in|ios:binary);if(!infile)cerr<<" open error"<<endl;exit(1);Order o;int n=o.getLine();for(int i=0;i<n;i+) /只讀取存放在數(shù)組中 但不對其進行相關(guān)操作infile>>receiptIdi>>buyerIDs
43、i;infile.close();/獲取Receipt.txt的行數(shù)int Receipt:getReceiptLine()ifstream in("Receipt.txt");string line;int n=0;while(getline(in,line)n+;in.close();return n;/從Receipt.txt中讀取數(shù)據(jù)放入Receipt對象數(shù)組中void Receipt:readReceipt(Receipt receipt)ifstream infile("Receipt.txt",ios:in|ios:binary);if(!
44、infile)cerr<<" open error"<<endl;exit(1);int n=getReceiptLine();for(int i=0;i<n;i+) /只讀取存放在數(shù)組中 但不對其進行相關(guān)操作string re,bu,bo,nu;infile>>re>>bo>>nu;int re2=atoi(re.c_str();receipti.receiptID=re2;receipti.bookID=bo;int nu2=atoi(nu.c_str();receipti.num=nu2;infile.
45、close();/判斷Receipt中是否存在用戶要求的發(fā)票編號,如果存在,返回行號數(shù)組類returnLs Receipt:Judge(int receiptid)Receipt receiptMAX;returnLs ls;readReceipt(receipt);/調(diào)用Read()函數(shù),獲取數(shù)據(jù),以便等下進行相關(guān)數(shù)據(jù)的判斷int j=0;for(int i=0; i<10; i+)int ri=receipti.receiptID;if(receiptid = ri)ls.lj=i;j+;return ls;/如果存在,返回其下標(biāo)數(shù)組的類/添加發(fā)票void Receipt:addRe
46、ceipt()string buyerID;string bookID;int num=0;/從Receipt.txt中讀取數(shù)據(jù)放入Receipt對象數(shù)組中Receipt receiptMAX;readReceipt(receipt);int l=getReceiptLine();/獲取行數(shù)receiptID=receiptl-1.receiptID;/將發(fā)票號的初值賦為Receipt.txt中最后一行的receiptID的值receiptID+;ofstream outfile("Receipt.txt",ios:app);if(!outfile) cerr<<
47、;" open error"<<endl; exit(1); /獲取買家IDcout<<"請輸入買家ID:"cin>>buyerID;/將買家ID和訂單編號寫入Order.txt中Order order;order.addOrder(receiptID,buyerID);/將訂單編號和書籍編號及數(shù)量存入Receipt.txt中cout<<"請輸入購買書籍編號及數(shù)量,當(dāng)書籍編號為0時,停止錄入"<<endl;while(bookID!="0")int i=0
48、;cin>>bookID;/當(dāng)用戶輸入0時跳出循環(huán),停止錄入if(bookID="0") break;cin>>num;outfile<<receiptID<<"t"outfile<<bookID<<"t"outfile<<num<<endl;/關(guān)閉文件outfile.close();cout<<"添加發(fā)票成功!"<<endl;/刪除發(fā)票void Receipt:deleteReceipt()/從
49、Receipt.txt中讀取數(shù)據(jù)放入Receipt對象數(shù)組中Receipt receiptMAX;readReceipt(receipt);cout<<"請輸入你要刪除的訂單的發(fā)票編號:"cin>>receiptID;/刪除Order.txt中用戶輸入訂單號的那行數(shù)據(jù)Order o;o.deleteOrder(receiptID);/獲取用戶所需訂單號在Receipt.txt所在的行returnLs ls = Judge(receiptID);if(ls.l0>=0)int n=getReceiptLine();ofstream outfile
50、("Receipt.txt");if(!outfile)cerr<<" open error"<<endl; exit(1); int j=0;for(int i=0; i<n; i+)/把下標(biāo)不等于ls中的訂單信息(即除了要刪的訂單信息外)其余的數(shù)據(jù)重新寫入磁盤保存if(i != ls.lj)outfile<<receipti.receiptID<<"t"outfile<<receipti.bookID<<"t"outfile<&
51、lt;receipti.num<<endl;elsej+;outfile.close();cout<<"刪除成功!"<<endl;elsecout<<"該數(shù)據(jù)庫沒有此訂單!"<<endl;/根據(jù)訂單號查找發(fā)票void Receipt:selectReceiptByRI()/讀取Receipt.txt中的內(nèi)容Receipt receiptMAX;readReceipt(receipt);/讀取Book.txt中的內(nèi)容string bookIDMAX, bookNameMAX, authorMAX,
52、 publishMAX, priceMAX;readBook(bookID, bookName, author, publish, price);/讀取Buyer.txt中的內(nèi)容string buyerIDMAX, nameMAX, addressMAX,typeMAX;readBuyer(buyerID,name,address,type);/讀取Order.txt中的內(nèi)容string receiptIdMAX,buyerIDsMAX;readOrder(receiptId,buyerIDs);cout<<"請輸入所需查找發(fā)票的編號:"int ri=0;cin
53、>>ri;double discount=1;int x=0;Order o;int n=o.getLine();/循環(huán)Order.txt中的內(nèi)容,匹配查找訂單號與循環(huán)內(nèi)容中的訂單號相同,從而獲得對應(yīng)訂單的買家IDfor(int i=0;i<n;i+)int rei=atoi(receiptIdi.c_str();if(ri=rei)x+;cout<<endl<<"發(fā)票編號:"<<ri<<endl;/循環(huán)Buyer.txt中的內(nèi)容,匹配查找訂單號的買家ID與循環(huán)體中的買家ID相同,輸出買家信息int n1=getBuyerLine();for(int k=0;k<n1;k+)if(buyerIDsi=buyerIDk)/判斷買家身份,獲取折扣if(typek="0")People p(buyerIDk,namek,addressk);p.display();else if(typek="1")Member m(buyerIDk,namek,addressk,0
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 產(chǎn)品度合同范例
- 單位租憑員工車輛合同范本
- 中糧銷售合同范本
- 化工散水出售合同范本
- seb采購合同范本
- 華為銷售合同范本
- 農(nóng)業(yè)采購合同范本格式
- 伐樹施工合同范本
- 代理業(yè)主房屋合同范本
- 寫作委托協(xié)議合同范本
- 地理-天一大聯(lián)考2025屆高三四省聯(lián)考(陜晉青寧)試題和解析
- 小巴掌童話課件
- 教科版六年級科學(xué)下冊全冊教學(xué)設(shè)計教案
- 初中數(shù)學(xué)新課程標(biāo)準(zhǔn)(2024年版)
- GB/T 19342-2024手動牙刷一般要求和檢測方法
- 2024年山東鐵投集團招聘筆試參考題庫含答案解析
- 8款-組織架構(gòu)圖(可編輯)
- 《鋼鐵是怎樣煉成的》讀書報告
- 中學(xué)生班干部培訓(xùn)方案(共4頁)
- 凈土資糧——信愿行(11)第六講凈業(yè)三福變化氣質(zhì)
- 美的集團公司分權(quán)手冊
評論
0/150
提交評論