代码拉取完成,页面将自动刷新
//
#include "stdafx.h"
#include "Actions.h"
#include <iostream>
#include <sstream>
using namespace std;
/**
* Allows registering a new student by entering all necessary information.
*/
int Actions::CreateStudent(LMS *sys, IO *io) {
string studentId = io->readStudentID();
string name = io->read("姓名");
int maths = io->readInt("数学成绩", 0, 100);
int computer = io->readInt("计算机成绩", 0, 100);
int english = io->readInt("英语成绩", 0, 100);
sys->AddStudent(studentId, name, maths, computer, english);
cout << "学生注册成功" << endl;
return 0;
};
/**
* Allows querying for a single student and delete it.
*/
int Actions::RemoveStudent(LMS *sys, IO *io) {
string studentId = io->readStudentID();
Student* student = new Student();
student->SetStudentId(studentId);
sys->DeleteStudent(student);
delete student;
cout << "成功删除学生." << endl;
return 0;
};
/**
* Shows detailed information about one or more students.
*/
int Actions::StudentsInfo(LMS *sys, IO *io) {
Student * student = io->readStudents(sys);
sys->FilterStudent(student);
return 0;
};
/**
* ALlows querying for a single student and update its properties.
*/
int Actions::UpdateStudent(LMS *sys, IO *io) {
cout << "请输入新数据:" << endl;
CreateStudent(sys, io);
return 0;
};
/**
* Allows exporting all student records to the specified file path.
*/
int Actions::ExportStudents(LMS *sys, IO *io) {
cout << "所有学生信息都会存档到本地目录." << endl;
cout << "如果本地有同名文件,存档会覆盖该文件" << endl;
cout << "文件路径可以设置为绝对路径或相对路径." << endl;
string filePath = io->read("文件名称");
filePath += ".txt";
sys->Save(( char *)filePath.c_str());
cout << "Export done." << endl;
return 0;
};
int Actions::ShowAllStudents(LMS *sys, IO *io) {
sys->Print();
return 0;
}
int Actions::RemoveAll(LMS *sys, IO *io) {
sys->Clear();
return 0;
}
int Actions::Exit(LMS *sys, IO *io) {
system("exit");
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。