From: Lukas Jiriste Date: Mon, 20 Jan 2025 17:48:30 +0000 (+0100) Subject: Implement execute for the rest of the forms X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=670dd38cdcf34f558fad4305bc88b8ddabc5319b;p=42%2FCPP_Module_05 Implement execute for the rest of the forms --- diff --git a/ex02/PresidentialPardonForm.cpp b/ex02/PresidentialPardonForm.cpp index 322873f..292b7b3 100644 --- a/ex02/PresidentialPardonForm.cpp +++ b/ex02/PresidentialPardonForm.cpp @@ -22,4 +22,5 @@ PresidentialPardonForm::~PresidentialPardonForm() void PresidentialPardonForm::execute(Bureaucrat const &executor) const { checkExecutorGrade(executor); + std::cout << getTarget() << " has been pardoned by Zaphod Beeblebrox.\n"; } diff --git a/ex02/ShrubberyCreationForm.cpp b/ex02/ShrubberyCreationForm.cpp index d3ec877..5a23890 100644 --- a/ex02/ShrubberyCreationForm.cpp +++ b/ex02/ShrubberyCreationForm.cpp @@ -1,4 +1,7 @@ #include "ShrubberyCreationForm.h" +#include +#include +#include ShrubberyCreationForm::ShrubberyCreationForm() : AForm() @@ -21,5 +24,22 @@ ShrubberyCreationForm::~ShrubberyCreationForm() void ShrubberyCreationForm::execute(Bureaucrat const &executor) const { + std::ofstream target_file; + checkExecutorGrade(executor); + target_file.open((getTarget() + std::string("_shrubbery")).c_str()); + target_file + << " * * \n" + << " * o * * o * \n" + << " * * * * * * \n" + << " * o * * * o * * \n" + << " * o o* * * o o* * \n" + << " * o * * * o * * \n" + << " * # # # * * # # # * \n" + << " * ##' * * ##' * \n" + << " ### ### \n" + << " ### ### \n" + << " ,###, ,###, \n" + << " ,#####. ,#####. \n"; + target_file.close(); }