【1022】Digital Library (30 分)

网友投稿 508 2022-10-31

【1022】Digital Library (30 分)

【1022】Digital Library (30 分)

#include#include#include#include#include#include#include #include#include#include #include using namespace std; //key:map>//5个map变量分别建立书名、作者、关键字、出版社及出版年份与id的映射关系map> mpTitle,mpAuthor,mpKey,mpPub,mpYear;void query(map>& mp,string& str){ //在mp中查找str if(mp.find(str) == mp.end()) printf("Not Found\n"); //找不到 else{ //找到str for(set::iterator it=mp[str].begin() ; it!=mp[str].end();it++){ printf("%07d\n",*it); //输出str对应的所有id } }} int main(){ int n,m,id,type; string title,author,key,pub,year; scanf("%d",&n); for(int i=0;i> key){ //每次读入!单个!关键词key mpKey[key].insert(id); //把id加入key对应的集合中 c=getchar(); //接收关键词key之后的字符 if(c == '\n') break; //如果是换行,说明关键词输入结束 } getline(cin,pub); //输入出版社pub mpPub[pub].insert(id); //把id加入pub对应的集合中 getline(cin,year); //输入年份year mpYear[year].insert(id); //把id加入year对应的集合中 } string temp; //查询次数 scanf("%d",&m); for(int i=0;i数字后scanf结束 getline(cin,temp); cout << type <<": "<

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Python程序,用于嗅探未加密的探测请求并将其记录到MySQL
下一篇:Polyglot是一种支持大量多语言应用程序的自然语言管道
相关文章

 发表评论

暂时没有评论,来抢沙发吧~