1 Star 0 Fork 0

水兵/Project1

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

搜索帮助