1 Star 0 Fork 0

水兵/Project1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
databaseAssistant.cpp 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
水兵 提交于 2020-04-01 11:04 +08:00 . 1.输入非法的提示
#include "databaseAssistant.h"
#include"agori.h"
#include"ADEQ.h"
int databaseAssistant::readFromFile(string path)
{
ifstream fin(path);
if (!fin.is_open()){
return 1;
}
else{
int id;
string st;
fin >> id >> st;
while (!fin.eof()){
vector<string> a = str_Split(st, ',');
string stId = to_string(id);
if (pCourse.graph[pCourse.findKey(stId)][7].empty()) pCourse.add(stId, 7, a);
For(i, 0, int(a.size()) - 1){
string key = stId + a[i];
if (!pAssistMem.queryHasKey(key)) pAssistMem.addKey(key);
}
fin >> id >> st;
}
fin.close();
return 0;
}
}
bool databaseAssistant::writeToFile(string path)
{
ofstream fout(path);
if (!fout.is_open()){
return 1;
}
else{
For(i, 0, int(pCourse.graph.size()) - 1){
if (!pCourse.graph[i][7].empty()){
fout << str_toStringId(atoi(pCourse.graph[i][0][0])) << "\t";
vector<string>& a = pCourse.query(pCourse.graph[i][0][0], 7);
fout << a[0];
For(j, 1, int(a.size()) - 1)
fout << "," << a[j];
fout << endl;
}
}
fout.close();
return 0;
}
}
databaseAssistant dataAssi;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/Shbinging/Project1.git
git@gitee.com:Shbinging/Project1.git
Shbinging
Project1
Project1
master

搜索帮助