Implement execute for the rest of the forms
authorLukas Jiriste <ljiriste@student.42prague.com>
Mon, 20 Jan 2025 17:48:30 +0000 (18:48 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Mon, 20 Jan 2025 17:48:30 +0000 (18:48 +0100)
ex02/PresidentialPardonForm.cpp
ex02/ShrubberyCreationForm.cpp

index 322873fa274ef35c55a244c280aaecfab583cf93..292b7b34c2247fb75942c5818b909d929a6a7f71 100644 (file)
@@ -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";
 }
index d3ec877539bab3799200e112153fd234af2aab61..5a23890a74b5c26815b9806fb4fe219788099b77 100644 (file)
@@ -1,4 +1,7 @@
 #include "ShrubberyCreationForm.h"
+#include <string>
+#include <iostream>
+#include <fstream>
 
 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();
 }