更改文件夹名。

This commit is contained in:
unlockable
2023-06-24 17:31:16 +08:00
parent ce89b63b8e
commit 1c58758515
19 changed files with 538 additions and 538 deletions

71
FinalProject/Student.cpp Normal file
View File

@@ -0,0 +1,71 @@
#include "Student.hpp"
Student::Student()
: number(0), name(""), _isAnyName(true), _isAnyNumber(true){};
Student::Student(const int _number, const std::string _name)
: number(_number), name(_name), _isAnyNumber(false), _isAnyName(false){};
const int Student::getNumber() const {
return this->number;
}
const std::string Student::getNumberString() const {
if (this->_isAnyNumber) {
return "[Any]";
}
return std::to_string(this->number);
}
const std::string Student::getName() const {
if (this->_isAnyName) {
return "[Any]";
}
return this->name;
}
void Student::setNumber(const int newNumber) {
this->_isAnyNumber = false;
this->number = newNumber;
}
void Student::setName(const std::string newName) {
this->_isAnyName = false;
this->name = newName;
}
void Student::setAnyNumber() {
this->_isAnyNumber = true;
this->number = 0;
}
bool Student::isAnyNumber() const {
return this->_isAnyNumber;
}
void Student::setAnyName() {
this->_isAnyName = true;
this->name = "";
}
bool Student::isAnyName() const {
return this->_isAnyName;
}
bool Student::matchesNumber(const Student &otherStu) const {
return (this->_isAnyNumber || otherStu._isAnyNumber) ||
this->number == otherStu.number;
}
bool Student::matchesName(const Student &otherStu) const {
return (this->_isAnyName || otherStu._isAnyName) ||
this->name == otherStu.name;
}
bool Student::matches(const Student &otherStu) const {
return this->matchesNumber(otherStu) && this->matchesName(otherStu);
}
bool Student::operator==(const Student &otherStu) const {
return this->matches(otherStu);
}