You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.7 KiB
64 lines
1.7 KiB
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* main.cpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/06/24 13:16:27 by narnaud #+# #+# */
|
|
/* Updated: 2022/06/26 16:34:45 by narnaud ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "Form.hpp"
|
|
|
|
|
|
void create_too_low(void) {
|
|
try {
|
|
Bureaucrat b("trash", 151);
|
|
} catch (std::exception &e) {
|
|
cout << "Grade 151 creation: " << e.what() << endl;
|
|
}
|
|
}
|
|
|
|
void create_too_high(void) {
|
|
try {
|
|
Bureaucrat b("god", 0);
|
|
} catch (std::exception &e) {
|
|
cout << "Grade 0 creation: " << e.what() << endl;
|
|
}
|
|
}
|
|
|
|
void first_evolve(Bureaucrat &b) {
|
|
try {
|
|
b.incrGrade();
|
|
} catch (std::exception &e) {
|
|
cout << "Grade 1 increase: "<< e.what() << endl;
|
|
}
|
|
}
|
|
|
|
void last_dismiss(Bureaucrat &b) {
|
|
try {
|
|
b.decrGrade();
|
|
} catch (std::exception &e) {
|
|
cout << "Grade 150 decrease: "<< e.what() << endl;
|
|
}
|
|
}
|
|
|
|
|
|
int main(void)
|
|
{
|
|
Bureaucrat first("first", 1);
|
|
Bureaucrat last("last", 150);
|
|
|
|
cout << first;
|
|
cout << last;
|
|
|
|
create_too_low();
|
|
create_too_high();
|
|
first_evolve(first);
|
|
last_dismiss(last);
|
|
|
|
cout << first;
|
|
cout << last;
|
|
}
|
|
|