From 670dd38cdcf34f558fad4305bc88b8ddabc5319b Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Mon, 20 Jan 2025 18:48:30 +0100 Subject: [PATCH] Implement execute for the rest of the forms --- ex02/PresidentialPardonForm.cpp | 1 + ex02/ShrubberyCreationForm.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) 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(); } -- 2.30.2