From 92a665752945aa7731ad51fa66ecac768064c51e Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Wed, 12 Feb 2025 13:28:42 +0100 Subject: Copy files from ex05 to ex06 --- ex06/Harl.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 ex06/Harl.cpp (limited to 'ex06/Harl.cpp') diff --git a/ex06/Harl.cpp b/ex06/Harl.cpp new file mode 100644 index 0000000..fcad030 --- /dev/null +++ b/ex06/Harl.cpp @@ -0,0 +1,55 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Harl.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dkaiser + +void Harl::complain(std::string level) +{ + std::string levels[4] = {"DEBUG", "INFO", "WARNING", "ERROR"}; + void (Harl::*funcs[4])() = {&Harl::debug, + &Harl::info, + &Harl::warning, + &Harl::error}; + for (int i = 0; i < 4; i++) + { + if (level == levels[i]) + (this->*funcs[i])(); + } +} + +void Harl::debug(void) +{ + std::cout << "I love having extra bacon for my "; + std::cout << "7XL-double-cheese-triple-pickle-special-ketchup burger. "; + std::cout << "I really do!" << std::endl; +} + +void Harl::info(void) +{ + std::cout << "I cannot believe adding extra bacon costs more money. "; + std::cout << "You didn’t put enough bacon in my burger! "; + std::cout << "If you did, I wouldn’t be asking for more!" << std::endl; +} + +void Harl::warning(void) +{ + std::cout << "I think I deserve to have some extra bacon for free. "; + std::cout << "I’ve been coming for years whereas you "; + std::cout << "started working here since last month." << std::endl; +} + +void Harl::error(void) +{ + std::cout << "This is unacceptable! I want to speak to the manager now."; + std::cout << std::endl; +} -- cgit v1.2.3