#include <bits/stdc++.h>
#include <fstream>
#include<map>
using namespace std;
struct book{
string name;
int money;
string cbs;
string type;
int id;
};
map<int,book> a;
book b;
string data;
ofstream outfile;
ifstream infile;
void find(){
int f_ans;
while(1){
cout<<"选择输入类型:"<<endl<<"1.输入书名"<<endl<<"2.输入类型"<<endl<<"3.输入书号"<<"返回主界面"<<endl;
cin>>f_ans;
switch(f_ans){
case 1:
cout<<"输入";
}
}
}
int main(int argc, char** argv) {
infile.open("书.txt");
while(getline(infile,data)){
cout<<data<<endl;
}
infile.close();
infile.open("书.txt");
while(getline(infile,data)){
b.name=data.substr(0,data.find("|"));
data=data.substr(data.find("|")+1);
b.money=stoi(data.substr(0,data.find("|")));
data=data.substr(data.find("|")+1);
b.cbs=data.substr(0,data.find("|"));
data=data.substr(data.find("|")+1);
b.type=data.substr(0,data.find("|"));
data=data.substr(data.find("|")+1);
b.id=stoi(data.substr(0,data.find("|")));
data=data.substr(data.find("|")+1);
a.insert(pair<int,book>(b.id,b));
cout<<b.name<<" "<<b.money<<" "<<b.cbs<<" "<<b.type<<" "<<b.id<<endl;
}
int ans;
while(1){
//system("cls");
cout<<"图书管理系统"<<endl<<"1.查询"<<endl<<"2.借阅"<<endl<<"3.还书"<<endl<<"4.关闭"<<endl;
cin>>ans;
if(ans==4){
break;
}
switch(ans){
case 1:
find();
break;
case 2:
break;
case 3:
break;
}
}
/*
outfile.open("书.txt",ios::app);
cin>>b.name>>b.money>>b.cbs>>b.fl;
outfile<<b.name<<"|"<<b.money<<"|"<<b.cbs<<"|"<<b.type<<endl;
outfile.close();
//.insert(pair<string,book>(""),b);
infile.open("书.txt");
while(getline(infile,data)){
cout<<data<<endl;
}
infile.close();
*/
// infile>>data;
// int m=0;
// data.substr(m,data.find("|"))=b.name;
// m=data.find("|");
// data.substr(m+1,data.find("|"))=b.money;
// m=data.find("|");
// data.substr(m+1,data.find("|"))=b.cbs;
// cout<<data<<endl;
// cout<<b.name<<" "<<b.money<<" "<<b.cbs;
// m=0;
return 0;
}