#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include "windows.h" #include #include #include #include #include using namespace std; class Applicant { public: Applicant(string fullName, string address, string dateOfBirth, int physicsScore, int mathScore, int russianScore, string GTOBadge = "Отсутствует", string medal = "Отсутствует", int olympiadWins = 0, int prizePlaces = 0) : fullName_(move(fullName)), address_(move(address)), dateOfBirth_(move(dateOfBirth)), physicsScore_(physicsScore), mathScore_(mathScore), russianScore_(russianScore), GTOBadge_(move(GTOBadge)), medal_(move(medal)), olympiadWins_(olympiadWins), prizePlaces_(prizePlaces) {} int getAgeAtAdmission() const { int admissionYear = 2021; int birthYear = stoi(dateOfBirth_.substr(6, 4)); return admissionYear - birthYear; } int getTotalScore() const { int score = physicsScore_ + mathScore_ + russianScore_; if (GTOBadge_ == "Золото") { score += 2; } else if (GTOBadge_ == "Серебро") { score += 1; } if (medal_ == "Золотая") { score += 5; } else if (medal_ == "Серебряная") { score += 3; } score += 2 * prizePlaces_ - 3 * olympiadWins_; return score; } bool canBeAdmitted() const { int minPhysicsScore = 40; int minMathScore = 45; int minRussianScore = 35; bool result = true; if (physicsScore_ < minPhysicsScore) { cout << "(баллы по физике недостаточны (Мин. порог = 40))" << endl; result = false; } if (mathScore_ < minMathScore) { cout << "(баллы по математике недостаточны (Мин. порог = 45))" << endl; result = false; } if (russianScore_ < minRussianScore) { cout << "(баллы по русскому языку недостаточны (Мин. порог = 35))" << endl; result = false; } return result; } void printInfo() { cout << "Абитуриент: " << fullName_ << endl; cout << "Адрес: " << address_ << endl; cout << "Дата рождения: " << dateOfBirth_ << endl; cout << "Баллы по физике: " << physicsScore_ << endl; cout << "Баллы по математике: " << mathScore_ << endl; cout << "Баллы по русскому языку: " << russianScore_ << endl; cout << "Значок ГТО: " << GTOBadge_ << endl; cout << "Медаль: " << medal_ << endl; cout << "Победы на олимпиадах: " << olympiadWins_ << endl; cout << "Призовые места на олимпиадах: " << prizePlaces_ << endl; } private: string fullName_; string address_; string dateOfBirth_; int physicsScore_; int mathScore_; int russianScore_; string GTOBadge_; string medal_; int olympiadWins_; int prizePlaces_; }; int main() { setlocale(LC_ALL, "Russian"); SetConsoleCP(1251); SetConsoleOutputCP(1251); string fullName, address, dateOfBirth, GTOBadge, medal; int physicsScore, mathScore, russianScore, olympiadWins, prizePlaces; cout << "Введите ФИО: "; getline(cin, fullName); cout << "Введите адрес (Город, Улица, номер дома, номер квартиры): "; getline(cin, address); cout << "Введите дату рождения (в формате ДД.ММ.ГГГГ): "; getline(cin, dateOfBirth); cout << "Введите баллы по физике: "; cin >> physicsScore; cout << "Введите баллы по математике: "; cin >> mathScore; cout << "Введите баллы по русскому языку: "; cin >> russianScore; cout << "Введите наличие значка ГТО (\"Золото\", \"Серебро\" или \"Отсутствует\"): "; cin >> GTOBadge; cout << "Введите наличие медали (\"Золотая\", \"Серебряная\" или \"Отсутствует\"): "; cin >> medal; cout << "Введите количество побед на олимпиадах: "; cin >> olympiadWins; cout << "Введите количество призовых мест на олимпиадах: "; cin >> prizePlaces; Applicant student(fullName, address, dateOfBirth, physicsScore, mathScore, russianScore, GTOBadge, medal, olympiadWins, prizePlaces); student.printInfo(); cout << endl; cout << "Возраст на момент поступления: " << student.getAgeAtAdmission() << endl; cout << endl; cout << "Общая сумма баллов: " << student.getTotalScore() << endl; cout << endl; cout << "Может ли быть зачислен: " << endl; cout << "Может ли быть зачислен: " << (student.canBeAdmitted() ? "Да (минимальный порог пройден)" : "Нет") << endl; return 0; }