|
|
@ -0,0 +1,801 @@
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include<fstream>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class item {
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
string itemname;
|
|
|
|
|
|
|
|
int intnum{ 0 }, strnum{ 0 };
|
|
|
|
|
|
|
|
vector<int> intentry;
|
|
|
|
|
|
|
|
vector<string> strentry;
|
|
|
|
|
|
|
|
friend class kind;
|
|
|
|
|
|
|
|
friend class handbook;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
item(const item &_item) {
|
|
|
|
|
|
|
|
itemname = _item.itemname;
|
|
|
|
|
|
|
|
intnum = _item.intnum;
|
|
|
|
|
|
|
|
strnum = _item.strnum;
|
|
|
|
|
|
|
|
intentry = _item.intentry;
|
|
|
|
|
|
|
|
strentry = _item.strentry;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
~item() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class kind {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
string kindname;
|
|
|
|
|
|
|
|
int intnum{0};
|
|
|
|
|
|
|
|
vector<string> intname;
|
|
|
|
|
|
|
|
int strnum{0};
|
|
|
|
|
|
|
|
vector<string> strname;
|
|
|
|
|
|
|
|
vector<item> itemlist;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kind(vector<item> _itemlist) {
|
|
|
|
|
|
|
|
this->itemlist = _itemlist;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
kind() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
~kind(){}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class handbook {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
vector<kind> kindlist;
|
|
|
|
|
|
|
|
int password{ 123456 };
|
|
|
|
|
|
|
|
handbook(vector<kind> _kindlist) {
|
|
|
|
|
|
|
|
this->kindlist = _kindlist;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
handbook() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
~handbook() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void kindprint(int n) {
|
|
|
|
|
|
|
|
cout << "\n种类名:" << kindlist[n].kindname;
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist[n].intnum; i++) {
|
|
|
|
|
|
|
|
cout << "\n第" << i + 1 << "个词条:" << kindlist[n].intname[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i{ 0 }; i <= kindlist[n].strnum; i++) {
|
|
|
|
|
|
|
|
cout << "\n第" << kindlist[n].intnum + i + 1 << "个词条:" << kindlist[n].strname[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void itemprint(int n0, int n1) {
|
|
|
|
|
|
|
|
cout << "\n物品名:" << kindlist[n0].itemlist[n1].itemname;
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist[n0].intnum; i++) {
|
|
|
|
|
|
|
|
cout << "\n" << kindlist[n0].intname[i] << ":" << kindlist[n0].itemlist[n1].intentry[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i{ 0 }; i <= kindlist[n0].strnum; i++) {
|
|
|
|
|
|
|
|
cout << "\n" << kindlist[n0].strname[i] << ":" << kindlist[n0].itemlist[n1].strentry[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void myregister() {
|
|
|
|
|
|
|
|
cout << "请选择你的登录方式: 1.管理员登录 2.游客登录\n";
|
|
|
|
|
|
|
|
cout << "请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel, password0{1};
|
|
|
|
|
|
|
|
while (cin >> sel) {
|
|
|
|
|
|
|
|
if (sel != 1 && sel != 2) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel == 1) {
|
|
|
|
|
|
|
|
cout << "请输入管理员密钥(输入1进入游客模式):";
|
|
|
|
|
|
|
|
while (cin >> password0) {
|
|
|
|
|
|
|
|
if (password0 != password && password0!=1) {
|
|
|
|
|
|
|
|
cout << "密码错误!\n" << "请重新输入你的密码(输入1进入游客模式):";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (password0 == 1)sel = 2;
|
|
|
|
|
|
|
|
menu(sel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void menu(int sel) {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
string sel1;
|
|
|
|
|
|
|
|
if (sel == 1) {
|
|
|
|
|
|
|
|
cout << "\t\t\t**********欢迎来到学生成绩管理系统**********" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t你可以进行以下操作:" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 1 信息创建(种类/物品) |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 2 信息删除(种类/物品) |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 3 信息修改(种类/物品) |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 4 物品清单查看 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 5 物品信息查找 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 6 物品数据分析 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 7 清空系统数据 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 0 退出 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t请选择【0-7】:";
|
|
|
|
|
|
|
|
while (cin >> sel1) {
|
|
|
|
|
|
|
|
if (sel1 != "1" && sel1 != "2" && sel1 != "3" && sel1!="4" && sel1!="5" && sel1!="6" && sel1!="7" && sel1!="0") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel1 == "1") {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要创建的类别: 1.种类 2.物品\n";
|
|
|
|
|
|
|
|
cout << "请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 != "1" && sel2 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel2 == "1")
|
|
|
|
|
|
|
|
kindcreate();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
itemcreate();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 == "2") {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要删除的类别: 1.种类 2.物品\n";
|
|
|
|
|
|
|
|
cout << "请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 != "1" && sel2 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel2 == "1")
|
|
|
|
|
|
|
|
kinddelete();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
itemdelete();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 == "3") {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要修改的类别: 1.种类 2.物品\n";
|
|
|
|
|
|
|
|
cout << "请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 != "1" && sel2 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel2 == "1")
|
|
|
|
|
|
|
|
kindamend();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
itemamend();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 == "4") {
|
|
|
|
|
|
|
|
inventory();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 == "5") {
|
|
|
|
|
|
|
|
search();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 == "6") {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 == "7") {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "是否确定要清空数据? 1.清空 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1") {
|
|
|
|
|
|
|
|
password = 123456;
|
|
|
|
|
|
|
|
kindlist.clear();
|
|
|
|
|
|
|
|
cout << "\n已清空系统数据";
|
|
|
|
|
|
|
|
string sel;
|
|
|
|
|
|
|
|
cout << "\n输入任意字符后按回车即可返回菜单";
|
|
|
|
|
|
|
|
cin >> sel;
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "是否保存数据? 1.保存 2.直接退出";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1") {
|
|
|
|
|
|
|
|
writefile();
|
|
|
|
|
|
|
|
cout << "已保存系统数据";
|
|
|
|
|
|
|
|
string sel;
|
|
|
|
|
|
|
|
cout << "\n输入任意字符后按回车即可退出";
|
|
|
|
|
|
|
|
cin >> sel;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
cout << "\t\t\t**********欢迎来到学生成绩管理系统**********" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t你可以进行以下操作:" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 1 物品清单查看 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 2 物品信息查找 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 3 物品数据分析 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t| 0 退出 |" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t|------------------------------------------|" << endl;
|
|
|
|
|
|
|
|
cout << "\t\t\t请选择【0-3】:";
|
|
|
|
|
|
|
|
while (cin >> sel1) {
|
|
|
|
|
|
|
|
if (sel1 != "1" && sel1 != "2" && sel1 != "3" && sel1 != "0") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel1 == "1") {
|
|
|
|
|
|
|
|
inventory();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 == "2") {
|
|
|
|
|
|
|
|
search();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 == "3") {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void kindcreate() {
|
|
|
|
|
|
|
|
kind kind0;
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请输入你要添加的种类名:";
|
|
|
|
|
|
|
|
cin>> kind0.kindname;
|
|
|
|
|
|
|
|
cout << "请输入你要创建的数字型词条数:";
|
|
|
|
|
|
|
|
cin >> kind0.intnum;
|
|
|
|
|
|
|
|
for(int i{0};i< kind0.intnum;i++){
|
|
|
|
|
|
|
|
cout << "请输入你要创建的第" << i + 1 << "个数字型词条名:";
|
|
|
|
|
|
|
|
string name;
|
|
|
|
|
|
|
|
cin >> name;
|
|
|
|
|
|
|
|
kind0.intname.push_back(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "请输入你要创建的文字型词条数:";
|
|
|
|
|
|
|
|
cin >> kind0.strnum;
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kind0.strnum; i++) {
|
|
|
|
|
|
|
|
cout << "请输入你要创建的第" << i + 1 << "个文字型词条名:";
|
|
|
|
|
|
|
|
string name;
|
|
|
|
|
|
|
|
cin >> name;
|
|
|
|
|
|
|
|
kind0.strname.push_back(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
kind0.strname.push_back("备注");
|
|
|
|
|
|
|
|
kindlist.push_back(kind0);
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "创建成功!\n";
|
|
|
|
|
|
|
|
int n = kindlist.size()-1;
|
|
|
|
|
|
|
|
kindprint(n);
|
|
|
|
|
|
|
|
cout << "\n是否继续创建? 1.继续创建 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 != "1" && sel2 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel2 == "1")
|
|
|
|
|
|
|
|
kindcreate();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void itemcreate() {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要创建的位置:\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist.size(); i++) {
|
|
|
|
|
|
|
|
cout << i + 1 << "." << kindlist[i].kindname << " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 < 1 || sel2 >kindlist.size()) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
item item0;
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请输入你要添加的物品名:";
|
|
|
|
|
|
|
|
cin >> item0.itemname;
|
|
|
|
|
|
|
|
item0.intnum=kindlist[sel2-1].intnum;
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < item0.intnum; i++) {
|
|
|
|
|
|
|
|
cout << "请输入你要创建物品的“" << kindlist[sel2-1].intname[i] << "”词条内容:";
|
|
|
|
|
|
|
|
int entry;
|
|
|
|
|
|
|
|
cin >> entry;
|
|
|
|
|
|
|
|
item0.intentry.push_back(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
item0.strnum = kindlist[sel2-1].strnum;
|
|
|
|
|
|
|
|
for (int i{ 0 }; i <= item0.strnum; i++) {
|
|
|
|
|
|
|
|
cout << "请输入你要创建物品的“" << kindlist[sel2-1].strname[i] << "”词条内容:";
|
|
|
|
|
|
|
|
string name;
|
|
|
|
|
|
|
|
cin >> name;
|
|
|
|
|
|
|
|
item0.strentry.push_back(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
kindlist[sel2-1].itemlist.push_back(item0);
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "创建成功!\n";
|
|
|
|
|
|
|
|
int n = kindlist[sel2 - 1].itemlist.size()-1;
|
|
|
|
|
|
|
|
itemprint(sel2 - 1, n);
|
|
|
|
|
|
|
|
cout << "\n是否继续创建? 1.继续创建 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1")
|
|
|
|
|
|
|
|
itemcreate();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void kinddelete() {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要删除的种类:\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist.size(); i++) {
|
|
|
|
|
|
|
|
cout << i + 1 << "." << kindlist[i].kindname << " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 < 1 || sel2 >kindlist.size()) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
vector<kind>::iterator it=kindlist.begin();
|
|
|
|
|
|
|
|
for (int i{ 1 }; i < sel2; i++)
|
|
|
|
|
|
|
|
it++;
|
|
|
|
|
|
|
|
kindlist.erase(it);
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "删除成功!\n";
|
|
|
|
|
|
|
|
cout << "\n是否继续删除? 1.继续删除 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1")
|
|
|
|
|
|
|
|
kinddelete();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void itemdelete() {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要删除的物品所属的种类:\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist.size(); i++) {
|
|
|
|
|
|
|
|
cout << i + 1 << "." << kindlist[i].kindname << " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 < 1 || sel2 >kindlist.size()) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要删除的物品:\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist[sel2-1].itemlist.size(); i++) {
|
|
|
|
|
|
|
|
cout << i + 1 << "." << kindlist[sel2-1].itemlist[i].itemname << " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel1;
|
|
|
|
|
|
|
|
while (cin >> sel1) {
|
|
|
|
|
|
|
|
if (sel1 < 1 || sel1 >kindlist[sel2-1].itemlist.size()) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
vector<item>::iterator it = kindlist[sel2-1].itemlist.begin();
|
|
|
|
|
|
|
|
for (int i{ 1 }; i < sel1; i++)
|
|
|
|
|
|
|
|
it++;
|
|
|
|
|
|
|
|
kindlist[sel2-1].itemlist.erase(it);
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "删除成功!\n";
|
|
|
|
|
|
|
|
cout << "\n是否继续删除? 1.继续删除 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1")
|
|
|
|
|
|
|
|
kinddelete();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void kindamend() {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要修改的种类:\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist.size(); i++) {
|
|
|
|
|
|
|
|
cout << i + 1 << "." << kindlist[i].kindname << " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 < 1 || sel2 >kindlist.size()) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
int j{ 1 };
|
|
|
|
|
|
|
|
cout << "1."<<kindlist[sel2-1].kindname << "\t";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist[sel2-1].intnum; i++) {
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
cout << j << "." << kindlist[sel2 - 1].intname[i] << "\t\t ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i{ 0 }; i <= kindlist[sel2-1].strnum; i++) {
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
cout << j << "." << kindlist[sel2 - 1].strname[i] << "\t\t ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << endl;
|
|
|
|
|
|
|
|
cout << "请选择你要修改的内容:\n";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入内容前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel1;
|
|
|
|
|
|
|
|
while (cin >> sel1) {
|
|
|
|
|
|
|
|
if (sel1 < 1 || sel1 >kindlist[sel2-1].intnum+kindlist[sel2-1].strnum+2) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel1 == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "你想将“" << kindlist[sel2 - 1].kindname << "”修改为:";
|
|
|
|
|
|
|
|
cin >> kindlist[sel2-1].kindname;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel1 > 1 && sel1 < kindlist[sel2 - 1].intnum + 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "你想将“" << kindlist[sel2 - 1].intname[sel1 - 2] << "”修改为:";
|
|
|
|
|
|
|
|
cin >> kindlist[sel2 - 1].intname[sel1 - 2];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "你想将“" << kindlist[sel2 - 1].strname[sel1 - kindlist[sel2 - 1].intnum - 2] << "”修改为:";
|
|
|
|
|
|
|
|
cin >> kindlist[sel2 - 1].strname[sel1 - kindlist[sel2 - 1].intnum - 2];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "修改成功!";
|
|
|
|
|
|
|
|
kindprint(sel2 - 1);
|
|
|
|
|
|
|
|
cout << "\n是否继续修改? 1.继续修改 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1")
|
|
|
|
|
|
|
|
kindamend();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void itemamend() {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要修改的种类:\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist.size(); i++) {
|
|
|
|
|
|
|
|
cout << i + 1 << "." << kindlist[i].kindname << " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel1;
|
|
|
|
|
|
|
|
while (cin >> sel1) {
|
|
|
|
|
|
|
|
if (sel1 < 1 || sel1 >kindlist.size()) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要修改的物品:\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist[sel1-1].itemlist.size(); i++) {
|
|
|
|
|
|
|
|
cout << i + 1 << "." << kindlist[sel1-1].itemlist[i].itemname << " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel2;
|
|
|
|
|
|
|
|
while (cin >> sel2) {
|
|
|
|
|
|
|
|
if (sel2 < 1 || sel2 >kindlist[sel1-1].itemlist.size()) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
int j{ 1 };
|
|
|
|
|
|
|
|
cout << "1." << kindlist[sel1 - 1].itemlist[sel2-1].itemname << "\t";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist[sel1 - 1].intnum; i++) {
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
cout << j << "." << kindlist[sel1 - 1].itemlist[sel2-1].intentry[i] << "\t\t ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i{ 0 }; i <= kindlist[sel1 - 1].strnum; i++) {
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
cout << j << "." << kindlist[sel1 - 1].itemlist[sel2-1].strentry[i] << "\t\t ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << endl;
|
|
|
|
|
|
|
|
cout << "请选择你要修改的内容:\n";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入内容前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel;
|
|
|
|
|
|
|
|
while (cin >> sel) {
|
|
|
|
|
|
|
|
if (sel < 1 || sel >kindlist[sel1 - 1].intnum + kindlist[sel1 - 1].strnum + 2) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "你想将“" << kindlist[sel1 - 1].itemlist[sel2-1].itemname << "”修改为:";
|
|
|
|
|
|
|
|
cin >> kindlist[sel1 - 1].itemlist[sel2 - 1].itemname;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (sel > 1 && sel < kindlist[sel1 - 1].intnum + 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "你想将“" << kindlist[sel1 - 1].itemlist[sel2 - 1].intentry[sel - 2] << "”修改为:";
|
|
|
|
|
|
|
|
cin >> kindlist[sel1 - 1].itemlist[sel2 - 1].intentry[sel - 2];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "你想将“" << kindlist[sel1 - 1].itemlist[sel2-1].strentry[sel - kindlist[sel1 - 1].intnum - 2] << "”修改为:";
|
|
|
|
|
|
|
|
cin >> kindlist[sel1 - 1].itemlist[sel2 - 1].strentry[sel - kindlist[sel1 - 1].intnum - 2];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "修改成功!";
|
|
|
|
|
|
|
|
itemprint(sel1 - 1,sel2-1);
|
|
|
|
|
|
|
|
cout << "\n是否继续修改? 1.继续修改 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1")
|
|
|
|
|
|
|
|
itemamend();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void inventory() {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要查看的清单范围:\n";
|
|
|
|
|
|
|
|
cout << "1.全部\t";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist.size(); i++)
|
|
|
|
|
|
|
|
cout << i + 2 << "." << kindlist[i].kindname << "\t";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入选择前的序号后按回车):";
|
|
|
|
|
|
|
|
int sel1;
|
|
|
|
|
|
|
|
while (cin >> sel1) {
|
|
|
|
|
|
|
|
if (sel1 < 1 || sel1 >kindlist.size()+1) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel1 == 1) {
|
|
|
|
|
|
|
|
int j{ 0 };
|
|
|
|
|
|
|
|
vector<int>jx,jy;
|
|
|
|
|
|
|
|
cout << "全部:\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist.size(); i++) {
|
|
|
|
|
|
|
|
for (int k{ 0 }; k < kindlist[i].itemlist.size(); k++) {
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
cout << " " << j << "." << kindlist[i].itemlist[k].itemname<<endl;
|
|
|
|
|
|
|
|
jx.push_back(i);
|
|
|
|
|
|
|
|
jy.push_back(k);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int sel;
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请选择你要查看的物品\n" << "请输入你的选择(输入要查看物品前的序号):";
|
|
|
|
|
|
|
|
while (cin >> sel) {
|
|
|
|
|
|
|
|
if (sel < 1 || sel >j) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
itemprint(jx[j], jy[j]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
cout << kindlist[sel1 - 2].kindname<<":\n";
|
|
|
|
|
|
|
|
for (int i{ 0 }; i < kindlist[sel1 - 2].itemlist.size(); i++) {
|
|
|
|
|
|
|
|
cout << " " << i + 1 << "." << kindlist[sel1 - 2].itemlist[i].itemname << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int sel;
|
|
|
|
|
|
|
|
cout << "请选择你要查看的物品\n" << "请输入你的选择(输入要查看物品前的序号):";
|
|
|
|
|
|
|
|
while (cin >> sel) {
|
|
|
|
|
|
|
|
if (sel < 1 || sel >kindlist[sel1 - 2].itemlist.size()) {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
itemprint(sel1 - 2, sel - 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n是否继续查看? 1.继续查看 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1")
|
|
|
|
|
|
|
|
inventory();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void search() {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
cout << "请输入你要查找的物品名:";
|
|
|
|
|
|
|
|
string name;
|
|
|
|
|
|
|
|
bool a = 0;
|
|
|
|
|
|
|
|
cin >> name;
|
|
|
|
|
|
|
|
for (int i = 0; i < kindlist.size(); i++) {
|
|
|
|
|
|
|
|
for (int j = 0; j < kindlist[i].itemlist.size(); j++) {
|
|
|
|
|
|
|
|
if (name == kindlist[i].itemlist[j].itemname) {
|
|
|
|
|
|
|
|
a = 1;
|
|
|
|
|
|
|
|
itemprint(i, j);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a == 0) {
|
|
|
|
|
|
|
|
cout << "\n未查找到输入的物品名";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "\n是否继续查找? 1.继续查找 2.返回菜单";
|
|
|
|
|
|
|
|
cout << "\n请输入你的选择(输入方式前的序号后按回车):";
|
|
|
|
|
|
|
|
string sel3;
|
|
|
|
|
|
|
|
while (cin >> sel3) {
|
|
|
|
|
|
|
|
if (sel3 != "1" && sel3 != "2") {
|
|
|
|
|
|
|
|
cout << "输入字符不合法,请重新输入你的选择:";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sel3 == "1")
|
|
|
|
|
|
|
|
search();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
menu(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void readfile() {
|
|
|
|
|
|
|
|
ifstream kind12;
|
|
|
|
|
|
|
|
kind12.open("myfile.txt",ios::in);
|
|
|
|
|
|
|
|
kind12 >> password;
|
|
|
|
|
|
|
|
int kindnum;
|
|
|
|
|
|
|
|
kind12 >> kindnum;
|
|
|
|
|
|
|
|
for (int i = 0; i < kindnum; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind kind0;
|
|
|
|
|
|
|
|
int itemnum0;
|
|
|
|
|
|
|
|
kind12 >> itemnum0;
|
|
|
|
|
|
|
|
kind12 >> kind0.intnum;
|
|
|
|
|
|
|
|
kind12 >> kind0.strnum;
|
|
|
|
|
|
|
|
kind12 >> kind0.kindname;
|
|
|
|
|
|
|
|
for (int a = 0; a < kind0.intnum; a++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string intname0;
|
|
|
|
|
|
|
|
kind12 >> intname0;
|
|
|
|
|
|
|
|
kind0.intname.push_back(intname0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int b = 0; b <= kind0.strnum; b++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string strname0;
|
|
|
|
|
|
|
|
kind12 >> strname0;
|
|
|
|
|
|
|
|
kind0.strname.push_back(strname0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int j = 0; j < itemnum0; j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item item0;
|
|
|
|
|
|
|
|
kind12 >> item0.itemname;
|
|
|
|
|
|
|
|
for (int k{ 0 }; k < kind0.intnum; k++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int intentry0;
|
|
|
|
|
|
|
|
kind12 >> intentry0;
|
|
|
|
|
|
|
|
item0.intentry.push_back(intentry0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int h{ 0 }; h <= kind0.strnum; h++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string strentry0;
|
|
|
|
|
|
|
|
kind12 >> strentry0;
|
|
|
|
|
|
|
|
item0.strentry.push_back(strentry0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
kind0.itemlist.push_back(item0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
kindlist.push_back(kind0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
kind12.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void writefile() {
|
|
|
|
|
|
|
|
ofstream kind22;
|
|
|
|
|
|
|
|
kind22.open("myfile.txt", ios::out);
|
|
|
|
|
|
|
|
kind22 << password << endl;
|
|
|
|
|
|
|
|
kind22 << kindlist.size()<<endl;
|
|
|
|
|
|
|
|
for (int i = 0; i < kindlist.size(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind22 << kindlist[i].itemlist.size()<<endl;
|
|
|
|
|
|
|
|
kind22 << kindlist[i].intnum<<endl;
|
|
|
|
|
|
|
|
kind22 << kindlist[i].strnum<<endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < kindlist.size(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind22 << kindlist[i].kindname << endl;
|
|
|
|
|
|
|
|
for (int m = 0; m < kindlist[i].intnum; m++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind22 << kindlist[i].intname[m]<<endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int w = 0; w <= kindlist[i].strnum; w++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind22 << kindlist[i].strname[w]<<endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int j = 0; j < kindlist[i].itemlist.size(); j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind22 << kindlist[i].itemlist[j].itemname << endl ;
|
|
|
|
|
|
|
|
for (int k{ 0 }; k < kindlist[i].intnum; k++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind22 << kindlist[i].itemlist[j].intentry[k] << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int h{ 0 }; h <= kindlist[i].strnum; h++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind22 << kindlist[i].itemlist[j].strentry[h] << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
kind22.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
handbook _handbook;
|
|
|
|
|
|
|
|
_handbook.readfile();
|
|
|
|
|
|
|
|
_handbook.myregister();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|