-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobotomyRequestForm.cpp
More file actions
42 lines (32 loc) · 1.82 KB
/
RobotomyRequestForm.cpp
File metadata and controls
42 lines (32 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RobotomyRequestForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/26 13:45:54 by zelhajou #+# #+# */
/* Updated: 2024/12/30 16:36:54 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#include "RobotomyRequestForm.hpp"
RobotomyRequestForm::RobotomyRequestForm() : AForm("RobotomyRequest", 72, 45), _target("default") {}
RobotomyRequestForm::RobotomyRequestForm(const std::string &target) : AForm("RobotomyRequest", 72, 45), _target(target) {}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm &src) : AForm(src), _target(src._target) {}
RobotomyRequestForm::~RobotomyRequestForm() {}
RobotomyRequestForm &RobotomyRequestForm::operator=(const RobotomyRequestForm &src)
{
if (this != &src)
AForm::operator=(src);
return *this;
}
void RobotomyRequestForm::execute(Bureaucrat const &executor) const
{
checkExecution(executor);
std::cout << "* Drilling noises: Drrrrrrr... *" << std::endl;
std::srand(std::time(NULL));
if (std::rand() % 2)
std::cout << _target << " has been robotomized successfully!" << std::endl;
else
std::cout << _target << " robotomization failed." << std::endl;
}