最近終于寫了一個(gè)讓自己滿意的系統(tǒng),我在這里分享一下,順便總結(jié)一下自己的學(xué)習(xí)心得。
1.需求分析 聽的好像是要做項(xiàng)目一樣,但是無(wú)論寫什么程序,些什么系統(tǒng),都是要知道自己要干什么,要完成什么工作,實(shí)現(xiàn)那些功能,在這前列出一個(gè)表格,或是思維導(dǎo)圖,給自己一個(gè)方向,先規(guī)劃好再寫,不然會(huì)拉下很多東西,在我寫這個(gè)系統(tǒng)之前,我在圖書館的借書頁(yè)面,看了將近兩個(gè)小時(shí),中途又看了好多次,這次代碼不能說(shuō)是一個(gè)完美可以當(dāng)作工程性的使用,其中還有很多測(cè)試環(huán)節(jié),還有部分功能沒(méi)有實(shí)現(xiàn),比如二次檢索,三次檢索功能,數(shù)據(jù)少得可憐,肯定還有一些未知的錯(cuò)誤,所以我在這里真是分享我寫代碼,及調(diào)試代碼的方法跟過(guò)程。 2.寫代碼+調(diào)試代碼 寫代碼的時(shí)候一定要寫一個(gè)功能調(diào)試一個(gè)功能,所謂的一個(gè)功能不是一個(gè)類,而是一個(gè)類的一個(gè)函數(shù),如果一個(gè)函數(shù)會(huì)影響到其他函數(shù)的運(yùn)行,不調(diào)好之前的函數(shù),現(xiàn)在的函數(shù)也沒(méi)法運(yùn)行,當(dāng)代碼隨著項(xiàng)目的增大,代碼長(zhǎng)度幾何增長(zhǎng)是,再找錯(cuò)誤就很難的了,所以順著調(diào)試下去,以便你寫完的代碼是可以運(yùn)行的,是正確的,而具體能否實(shí)現(xiàn)功能在另說(shuō)。 數(shù)據(jù)類與操作類的分離,面向?qū)ο笠氖欠庋b性,操作抽象+數(shù)據(jù)抽象,繼承,寫代碼寫完能夠復(fù)用最好,亂糟糟的寫完不能復(fù)用的類扔在那里,以后再也不會(huì)用到,浪費(fèi)時(shí)間,完全可以寫一些代碼條理清晰,更重要的是,下次相似的代碼不用再繼續(xù)寫,這應(yīng)該是應(yīng)該具備的素養(yǎng)。 以下是我調(diào)試代碼的過(guò)程,最后代碼還是有一點(diǎn)錯(cuò)誤,這里是我的明明還是不好的原因,補(bǔ)充一下我認(rèn)為明明一定要有意義,可以將學(xué)生的每科學(xué)分定義為a b c d. …也可以定義為數(shù)學(xué) 英語(yǔ) 物理 c++…這樣可以增加代碼的可讀性。 引以為戒: 下文中這兩個(gè)MAP混用導(dǎo)致了一些問(wèn)題,以至于我交代碼的時(shí)候是錯(cuò)誤的還有沒(méi)有發(fā)現(xiàn)
map<string,int>idtorea; //讀者id對(duì)應(yīng)讀者數(shù)據(jù)下標(biāo)
map<string ,int> idtoob; //圖書id對(duì)應(yīng)圖書數(shù)據(jù)下標(biāo)
時(shí)間類 時(shí)間類第一次調(diào)試運(yùn)行,測(cè)試有參無(wú)參,重載<< ,>>和+
寫到后邊發(fā)現(xiàn),自己重載的+錯(cuò)了,而且還需要計(jì)算兩個(gè)時(shí)間類相差的時(shí)間,回頭從新寫的重載+,跟-
圖書類 這里調(diào)試很多遍,開始留了一個(gè)應(yīng)還時(shí)間Time類,后來(lái)發(fā)現(xiàn),沒(méi)有用。 后來(lái)想到,可能查詢歸還時(shí)間,所以寫了get函數(shù),但是函數(shù)不能反回局部類對(duì)象,只好寫成static。 因?yàn)楹筮叺臅r(shí)候需要輸出,但是有些數(shù)據(jù)只有管理員能夠看到,所以寫完后邊的回來(lái)寫的print函數(shù)。 讀者類 這里學(xué)生能做的事情不多,修改密碼,查詢個(gè)人信息,別的都做不了。
在后邊實(shí)現(xiàn)借書就要在數(shù)據(jù)類中實(shí)現(xiàn)更改,所以在這里加了一條進(jìn)行測(cè)試所添加的操作。 操作數(shù)據(jù)類 每一條新數(shù)據(jù)都必須,擁有參初始化,除了文件讀取除外。 操作類也面臨著不能直接輸出的尷尬境界,所以回來(lái),再寫一個(gè)print。 終于看到自己的程序成功運(yùn)行,也試了幾組錯(cuò)誤情況。基本無(wú)問(wèn)題。
#include<bits/stdc++.h.>
using namespace std;
class Time
{int year,month,day;
public:Time(){loadtime();}Time(int y,int m,int d):year(y),month(m),day(d){}; //用與圖書出版日期等已知數(shù)據(jù)的對(duì)象的初始化;//不能創(chuàng)建圖書對(duì)象,有參初始化就沒(méi)意義。// Time(Time & a){year=a.year,month=a.month,day=a.day;} //用一個(gè)時(shí)間類初始化一個(gè)時(shí)間類,為后續(xù)操作準(zhǔn)備;//這句不注釋就沒(méi)法運(yùn)行,不得解void loadtime(); //定義時(shí)間獲取函數(shù),學(xué)生借書的時(shí)間不可更改,直接從系統(tǒng)讀入;friend istream & operator>>(istream &in,Time & a); //不設(shè)置set函數(shù),時(shí)間直接一次性全部修改即可;friend stringstream & operator>>(stringstream &in,Time & a);friend ostream & operator<<(ostream &out,Time & a);bool operator <(const Time &d)const{ //重載小于號(hào),用于數(shù)據(jù)時(shí)間排序,不需要修改數(shù)據(jù)const;return year!=d.year?year<d.year:month!=d.month?month<d.month:day<d.day;}int judge() const; //判斷是否為閏年,用于續(xù)借日期的變化;int judge(int year) const ;//寫一個(gè)有參的判斷函數(shù);Time operator +(int a) ; //重載加號(hào),用于續(xù)借日期的變化;friend int operator -(Time a,Time b); //計(jì)算兩段時(shí)間間隔;
};
Time Time::operator +(int a)
{int m[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};day+=a;int flag=1;while(day>m[month]){if(month==2){if(day>m[month]+judge()){day-=m[month]+judge();month++;}}else {day=day-m[month];month++;}//因?yàn)橐粚?duì)大括號(hào)跑了好幾遍,敲ACM也一樣,不要偷懶if(month>12){month-=12;year++;}}
}
int operator -(Time a,Time b)
{int monthdays[2][12] = { { 31,28,31,30,31,30,31,31,30,31,30,31 },{ 31,29,31,30,31,30,31,31,30,31,30,31 } };int yeardays[2] = { 365,366 };int sumdays=0;if (a.year == b.year&& a.month == b.month){sumdays = b.day - a.day;}elseif (a.year == b.year){sumdays += monthdays[a.judge(a.year)][a.month-1] - a.day;for (int i = a.month; i < b.month-1; i++)sumdays += monthdays[a.judge(a.year)][i];sumdays += b.day;}else{sumdays += monthdays[a.judge(a.year)][a.month-1] - a.day;for (int i = a.month; i < 12; i++)sumdays += monthdays[a.judge(a.year)][i];for (int i = a.year + 1; i < b.year; i++)sumdays += yeardays[a.judge(i)];for (int i = 0; i < b.month - 1; i++)sumdays += monthdays[a.judge(b.year)][i];sumdays += b.day;}return sumdays;
}
int Time::judge() const{if(year % 4 == 0 && year %100 != 0 ||year % 400 == 0) return 1;else return 0;
}
int Time::judge(int year) const{if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)return 1;else return 0;
}
void Time::loadtime(){time_t rawtime;struct tm *ptminfo;time(&rawtime);ptminfo = localtime(&rawtime);year=ptminfo->tm_year + 1900;month=ptminfo->tm_mon + 1;day=ptminfo->tm_mday;
}
istream & operator>>(istream &in,Time & a){in>>a.year>>a.month>>a.day;return in;
}
ostream & operator<<(ostream &out,Time & a)
{out<<a.year<<" "<<a.month<<" "<<a.day<<" ";return out;
}
stringstream & operator>>(stringstream &in,Time & a){in>>a.year>>a.month>>a.day;return in;
}
/*
int main()
{Time demo1;//無(wú)參初始化對(duì)象cout<<demo1<<endl;Time demo2(demo1);//有參初始化對(duì)象,便于不同時(shí)間定義對(duì)象,時(shí)間不同;cout<<demo2<<endl;demo2+60;//為續(xù)借,即還書時(shí)間做準(zhǔn)備;cout<<demo2;Time demo3(2000,03,19);cout<<demo3<<endl;
}
*/
/*
int main()
{Time demo1,demo2;cin>>demo1>>demo2;int d=demo1-demo2;demo1+d;cout<<demo1<<endl;cout<<d<<endl;
}*/
class Book
{string name;string press; //出版社string pubtime; //出版時(shí)間通常在圖書館只有年份string author; //作者string suoshu; //索書號(hào)string id; //每本書都有唯一的條形碼,兩本完全一樣的書,在這里應(yīng)該看作兩本書string locate;string jsr; //指向借書人數(shù)據(jù)在的位置的下標(biāo)(-1),代表可借int fk; //每本書都有自己的罰款,不會(huì)影響其他書籍,定義在這里比定義在讀者類要合適bool xj; //比起寫入記錄中查詢,寫在圖書中,無(wú)論是還書,還是續(xù)借,都更加便捷Time jy;// Time rebac;
public:Book():name(""),press(""),author(""),id(""),suoshu(""),locate(""),jsr("-1"),fk(0){}//學(xué)生端不能創(chuàng)建書籍對(duì)象,只寫一個(gè)無(wú)參初始化,用于讀取文件數(shù)據(jù);string getname ()const{return name;}string getpress ()const{return press;}string getauthor ( )const{return author;}string getpubtime ( )const{return pubtime;}string getid ( )const{return id;}string getsuoshu ( )const{return suoshu;} //通過(guò)上述get函數(shù)為下面的查詢做準(zhǔn)備;int getfk(){jsfk();return fk;}void xxj(){/*if(fk<=0)xj=!xj;else cout<<"請(qǐng)先繳清罰款"<<endl;*/ //改為在讀者類判斷,不只是一本書的罰款,會(huì)影響借書;xj=!xj;}bool getxj(){ return xj;}void js(string idcard){jsr=idcard;} //學(xué)號(hào)跟圖書的條形碼是唯一的,由此來(lái)對(duì)應(yīng);Time& getreback();void jsfk();void print();friend istream & operator>>(istream &in,Book & a);friend ostream & operator<<(ostream &out,Book & a);
};
void Book::jsfk()
{int brr;if(xj) brr=120;else brr=60;Time tem;fk=tem-jy-brr;if(fk<0) fk=0;
}
void Book::print()
{cout<<name<<" "<<press<<" "<<author<<" "<<id<<" "<<suoshu<<" "<<locate<<" ";if(jsr!="-1") cout<<"已借出 歸還時(shí)間:"<<getreback()<<endl;else cout<<endl;
}
Time& Book::getreback(){static Time tem(jy);tem+60*(1+getxj());return tem;
}
istream & operator>>(istream &in,Book & a){in>>a.name>>a.press>>a.pubtime>>a.author>>a.suoshu>>a.id>>a.jsr>>a.locate>>a.jy>>a.xj;return in;
}
ostream & operator<<(ostream &out,Book & a){out<<a.name<<" "<<a.press<<" "<<a.pubtime<<" "<<a.author<<" "<<a.suoshu<<" "<<a.id<<" "<<a.jsr<<" "<<a.locate<<" "<<a.jy<<" "<<a.xj;return out;
}
//記 北京機(jī)械工業(yè)出版社 2016 胡凡 TP301.6/H569 01664298 123456 -1 采編部在編 2018 5 16 1
/*
int main()
{Book demo;cin>>demo;cout<<demo;cout<<demo.getname()<<endl;cout<<demo.getpress()<<endl;cout<<demo.getauthor()<<endl;cout<<demo.getsuoshu()<<endl;cout<<demo.getpubtime()<<endl;cout<<demo.getfk()<<endl;int jsr;cin>>jsr;demo.js(jsr);cout<<demo.getxj()<<endl;demo.xxj();cout<<demo.getxj()<<endl;cout<<demo<<endl;
} //算法筆記 北京機(jī)械工業(yè)出版社 2016 胡凡 TP301.6/H569 01664298 123 采編部在編 2018 5 16 1
*/
/*
int main()
{Book demo;cin>>demo;cout<<demo.getreback();
}*/
/*
int main()
{Book demo1;//無(wú)參初始化對(duì)象cin>>demo1;demo1.print();
}
*/
class Student
{string name;string id;string key;string mail;vector<string> jy;/*按時(shí)間先后借的書,則為有序,int是圖書數(shù)據(jù)的ID;通過(guò)下標(biāo)聯(lián)通了圖書與讀者。*/int yj;//已借圖書
public:Student() :name(""),id(""),key(""),mail(""){jy.clear();}//void printxx() 想寫打印信息的功能,但是目前這個(gè)類看不到圖書數(shù)據(jù),無(wú)法關(guān)聯(lián)。轉(zhuǎn)而寫get函數(shù);vector<string> getjy() const{return jy;} //先返回一個(gè)vector對(duì)象,目前看不到圖書數(shù)據(jù),所以返回后,在操作類中使用string getname(){return name;}string getid(){return id;}string getkey(){return key;}string getmail(){return mail;}int getyj()const {return yj;}void setkey(string tem) ; //修改密碼void jieyue(string obid); //借閱圖書,圖書館的借閱最后都是按照書的唯一的條碼來(lái)借閱void reback(string obid); //歸還同上。/*現(xiàn)在看不到圖書數(shù)據(jù),只能寫出部分借閱,歸還操作,在操作類中應(yīng)判斷是否具有罰款,此函數(shù)僅用于修改學(xué)生,作為子函數(shù)使用*/friend istream & operator>>(istream &in,Student & a);friend ostream & operator<<(ostream &out,Student & a);
} ;
istream & operator>>(istream &in,Student & a)
{in>>a.name>>a.id>>a.key>>a.mail>>a.yj;string tem;for(int i=0;i<a.yj;i++) {in>>tem;a.jy.push_back(tem);}return in;
}
ostream & operator<<(ostream &out,Student & a)
{out<<a.name<<" "<<a.id<<" "<<a.key<<" "<<a.mail<<" "<<a.yj<<" ";for(int i=0;i<a.yj;i++) cout<<a.jy[i]<<" ";return out;
}
void Student::jieyue(string obid)
{if(yj>=10) cout<<"借閱數(shù)量已達(dá)上限"<<endl;else jy.push_back(obid);yj=jy.size();
}
void Student::reback(string obid) //歸還操作很寬泛,甚至都不需要登陸賬號(hào),但是根據(jù)圖書找到人,最后還是要根據(jù)id在這人身上去掉
{//不需要容錯(cuò),如果系統(tǒng)不崩潰,從書籍查借人一定是唯一的auto po=find(jy.begin(),jy.end(),obid);if(po==jy.end()) cout<<"還書失敗,請(qǐng)聯(lián)系管理員"<<endl;else jy.erase(po);yj=jy.size();
}
void Student::setkey(string tem)
{while(tem!=key){cout<<"密碼錯(cuò)誤,請(qǐng)重試"<<endl;cin>>tem;}cin>>tem;key=tem;
}
/*
int main()
{Student demo;cin>>demo;cout<<demo.getname()<<endl;cout<<demo.getid()<<endl;cout<<demo.getkey()<<endl;cout<<demo.getmail()<<endl;cout<<demo.getyj()<<endl;cout<<demo;
}*/
//張俊浩 2018212513 123456 529934209@qq.com 1 203
/*
int main()
{string tem;Student demo;cin>>demo>>tem;demo.jieyue(tem);cout<<demo<<endl;cin>>tem;demo.reback(tem);cout<<demo;
}
*/class Operate //記錄只能生成不能修改
{Time time;string oper; //操作string peo; //操作人idstring boo; //圖書對(duì)象IDint fk; //當(dāng)操作為還書時(shí)有真實(shí)罰款,其余為-1
public:Operate( ):oper(""),peo(""),boo(""),fk(-1){} //僅用于文件讀寫Operate(string o,string p,string b,int c):oper(o),peo(p),boo(b),fk(c){time.loadtime();} //操作無(wú)論管理員,學(xué)生都無(wú)法改變時(shí)間;string getname(){return peo;}string getbook(){return boo;}string getoper(){return oper;}int getfk(){return fk;} // 用于后續(xù)查詢操作void print() ;friend istream & operator>>(istream &in,Operate & a);friend ostream & operator<<(ostream &out,Operate & a);
} ;
void Operate::print()
{cout<<time<<" "<<peo<<" "<<oper<<" "<<boo<<" ";if(fk!=-1) cout<<"繳納罰款:"<<fk<<endl;
}
istream & operator>>(istream &in,Operate & a)
{in>>a.time>>a.peo>>a.oper>>a.boo>>a.fk;return in;
}
ostream & operator<<(ostream &out,Operate & a)
{out<<a.time<<" "<<a.peo<<" "<<a.oper<<" "<<a.boo<<" "<<a.fk<<" ";return out;
}
/*
int main()
{Operate demo;cin>>demo;cout<<demo.getname()<<" "<<demo.getoper()<<" "<<demo.getbook()<<" "<<demo.getfk()<<endl;cout<<demo<<endl;string name,op,ob;int fk;cin>>name>>op>>ob>>fk;Operate demo2(name,op,ob,fk);cout<<demo2<<endl;
}
*/
/*
int main()
{Operate demo;cin>>demo;demo.print();
}*/
class Library
{string account;string password; //每次登入圖書館進(jìn)行操作都要有賬號(hào)密碼vector<Book> book;vector<Student> reader;vector<Operate> record; //三個(gè)基礎(chǔ)數(shù)據(jù);//圖書查詢操作所需數(shù)據(jù)multimap<string,int> pubtimque; //出版時(shí)間multimap<string,int> suoshuque; // 索書號(hào)multimap<string,int> pressque; //出版社//書名與作者都需要模糊查詢//數(shù)據(jù)查詢map<string,int>idtorea; //讀者id對(duì)應(yīng)讀者數(shù)據(jù)下標(biāo)map<string ,int> idtoob; //圖書id對(duì)應(yīng)圖書數(shù)據(jù)下標(biāo)multimap<string,int> ridtorec; //讀者Id對(duì)應(yīng)操作數(shù)據(jù)下標(biāo)multimap<string,int> bidtorec; //圖書 id對(duì)應(yīng)操作數(shù)據(jù)下標(biāo)
public:Library(string ac,string pass): account(ac),password(pass){load();login();cout<<book.size();}void login();//書籍查詢操作void querysm(string name) ;//書名查詢void queryss(string suoshu) ; //索書號(hào)查詢void queryath(string ath); //作者查詢void querypres(string pre); //出版社查詢void querytim(string pub);//出版時(shí)間查詢//個(gè)人信息操作void quepers(); //查詢讀者身份信息void quebrro();//查詢借閱信息void queop(); //查詢讀者操作記錄(僅個(gè)人)//基礎(chǔ)操作int cxkj(); //查詢課可借書的數(shù)量void jieshu(string id) ;void huanshu(string id);void xujie(string id); //圖書館雖然不用輸入書的條碼,但是現(xiàn)在也是通過(guò)書的磁獲取//也應(yīng)該看是輸入,比如某些地方仍用掃碼,甚至手輸void load();void save();~Library(){save();}
};
//有些map是給管理端用的,這里只寫不讀;
void Library::login()
{while(1){auto po=idtorea.find(account);if(po!=idtorea.end()&&reader[po->second].getkey()==password) break;cout<<"賬號(hào)密碼不匹配\n請(qǐng)重新輸入\n"; //可以在分個(gè)賬號(hào)不存在,但看很多網(wǎng)站,//都不會(huì)報(bào)不存在,為了提高一點(diǎn)安全性;cin>>account>>password;}cout<<"登陸成功\n";
}
void Library:: querysm(string name)
{for(auto po=book.begin();po!=book.end();po++){auto m=po->getname().find(name);if(m!=-1) po->print();}
}
void Library:: queryss(string suoshu)
{auto beg=suoshuque.lower_bound(suoshu);auto en=suoshuque.upper_bound(suoshu);for(auto po=beg;po!=en;po++)book[po->second].print();
}
void Library:: queryath(string ath){for(auto po=book.begin();po!=book.end();po++){auto m=po->getauthor().find(ath);if(m!=-1) po->print();}
}
void Library:: querypres(string pre)
{auto beg=pressque.lower_bound(pre);auto en=pressque.upper_bound(pre);for(auto po=beg;po!=en;po++) book[po->second].print();
}
void Library:: querytim(string pub)
{auto beg=pubtimque.lower_bound(pub);auto en=pubtimque.upper_bound(pub);for(auto po=beg;po!=en;po++)book[po->second].print();
}
void Library:: quepers(){cout<<reader[idtoob[account]].getname()<<" ";cout<<reader[idtoob[account]].getid()<<" ";cout<<reader[idtoob[account]].getmail()<<" ";cout<<reader[idtoob[account]].getyj()<<" ";cout<<cxkj()<<endl;
}
void Library:: quebrro()
{for(auto po=reader[idtoob[account]].getjy().begin();po!=reader[idtoob[account]].getjy().end();po++)book[idtoob[ *po]].print();
}
void Library:: queop()
{auto beg=ridtorec.lower_bound(account);auto en=ridtorec.upper_bound(account);for(auto po=beg;po!=en;po++)record[po->second].print();
}
int Library:: cxkj()
{int ans=0;for(auto po=reader[idtoob[account]].getjy().begin();po!=reader[idtoob[account]].getjy().end();po++)ans+=book[idtoob[ *po]].getfk();if(ans>0) return -1;else return 10-reader[idtoob[account]].getjy().size();
}
void Library:: jieshu(string id)
{if(cxkj()==-1){ cout<<"歸還逾期,請(qǐng)先歸還\n"; return ;}else if(cxkj()==0) { cout<<"達(dá)到借書上限\n"; return ;}reader[idtorea[account]].jieyue(id);book[idtoob[id]].js(account);Operate tem("借書",account,id,-1);record.push_back(tem);ridtorec.insert(make_pair(account,record.size()-1));bidtorec.insert(make_pair(id,record.size()-1));
}
void Library:: huanshu(string id)
{reader[idtorea[account]].reback(id);//異常在 reback拋出book[idtoob[id]].js("-1");int money=book[idtoob[id]].getfk();Operate www("還書",account,id,money);record.push_back(www);ridtorec.insert(make_pair(account,record.size()-1));bidtorec.insert(make_pair(id,record.size()-1));
}
void Library:: xujie(string id)
{if(cxkj()==-1){ cout<<"歸還逾期,請(qǐng)先歸還\n"; return ;}else if(cxkj()==0) { cout<<"達(dá)到借書上限\n"; return ;}book[idtoob[id]].xxj();Operate tem("續(xù)借",account,id,-1);record.push_back(tem);ridtorec.insert(make_pair(account,record.size()-1));bidtorec.insert(make_pair(id,record.size()-1));
}
void Library::save()
{ofstream out1("d:\\book.txt",ios::out);for(auto po=book.begin(); po!=book.end(); po++)out1<<*po<<endl;out1.close();ofstream out2("d:\\reader.txt",ios::out);for(auto po=reader.begin(); po!=reader.end(); po++)out2<<*po<<endl;out2.close();ofstream out3("d:\\record.txt",ios::out);for(auto po=record.begin(); po!=record.end(); po++)out3<<*po<<endl;out3.close();
}
void Library:: load()
{ifstream in1("d:\\book.txt",ios::in);if(in1){Book tem1;book.clear();while(in1>>tem1){book.push_back(tem1);idtorea.insert(make_pair(tem1.getid(),book.size()-1));pubtimque.insert(make_pair(tem1.getpubtime(),book.size()-1));suoshuque.insert(make_pair(tem1.getsuoshu(),book.size()-1));pressque.insert(make_pair(tem1.getpress(),book.size()-1));}in1.close();}ifstream in2("d:\\reader.txt",ios::in);if(in2){reader.clear();Student tem2;while(in2>>tem2){reader.push_back(tem2);idtorea.insert(make_pair(tem2.getid(),reader.size()-1));}in2.close();}ifstream in3("d:\\record.txt",ios::in);if(in3){record.clear();Operate tem3;while( in3>>tem3){record.push_back(tem3);ridtorec.insert(make_pair(tem3.getname(),record.size()-1));bidtorec.insert(make_pair(tem3.getbook(),record.size()-1));}in3.close();}
}
int main()
{string account,key,name,suoshu,ath,pre,pub,id;cin>>account>>key;Library demo(account,key);cin>>name;demo. querysm( name) ;//測(cè)試書名查詢cin>>suoshu;demo. queryss( suoshu) ; //測(cè)試索書號(hào)查詢cin>>ath;demo. queryath( ath); //測(cè)試作者查詢cin>>pre;demo. querypres( pre); //測(cè)試出版社查詢cin>>pub;demo. querytim( pub);//測(cè)試出版時(shí)間查詢//測(cè)試個(gè)人信息操作demo. quepers(); //測(cè)試查詢讀者身份信息demo. quebrro();//測(cè)試查詢借閱信息demo. queop(); //測(cè)試查詢讀者操作記錄(僅個(gè)人)//測(cè)試基礎(chǔ)操作demo. cxkj(); //測(cè)試查詢課可借書的數(shù)量cin>>id;demo. jieshu( id) ;cin>>id;demo. huanshu( id);cin>>id;demo. xujie( id);return 0;
}
總結(jié)
以上是生活随笔 為你收集整理的图书馆管理系统用户端心得 的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
如果覺得生活随笔 網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔 推薦給好友。