| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* main.cpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2025/07/17 15:10:40 by bchanot #+# #+# */
- /* Updated: 2025/12/29 16:12:36 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include "Bureaucrat.hpp"
- #include <iostream>
- #include <limits>
- int main( void ) {
- Bureaucrat* bob = new Bureaucrat("bob", 150);
- Bureaucrat* jimmy = new Bureaucrat("jimmy", 1);
- std::cout << *bob << std::endl;
- std::cout << *jimmy << std::endl;
- try
- {
- bob->incrementGrade();
- jimmy->incrementGrade();
- }
- catch (std::exception & e)
- {
- std::cout << "Exception " << e.what() << std::endl;
- }
- std::cout << *bob << std::endl;
- std::cout << *jimmy << std::endl;
- try
- {
- jimmy->decrementGrade();
- bob->decrementGrade();
- bob->decrementGrade();
- }
- catch (std::exception & e)
- {
- std::cout << "Exception " << e.what() << std::endl;
- }
- std::cout << *bob << std::endl;
- std::cout << *jimmy << std::endl;
- Bureaucrat* tooHigh;
- try
- {
- tooHigh = new Bureaucrat("TooHigh", 0);
- }
- catch (std::exception & e)
- {
- std::cout << "Exception : " << e.what() << std::endl;
- }
-
- Bureaucrat* tooLow;
- try
- {
- tooLow = new Bureaucrat("TooLow", 151);
- }
- catch (std::exception & e)
- {
- std::cout << "Exception : " << e.what() << std::endl;
- }
- (void)tooLow;
- (void)tooHigh;
- delete (bob);
- delete (jimmy);
- return (0);
- }
|