aboutsummaryrefslogtreecommitdiff
path: root/cpp05
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-17 16:51:56 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-17 16:51:56 +0100
commita92013c92bfcd50b0e2561280c9eaa604843ade0 (patch)
treeb617be1b683acfccbb93162945e3cb1dd8171aac /cpp05
parent331c3596660fed6c8b04fdfd0a89435ccffaaf20 (diff)
downloadpiscine_cpp-a92013c92bfcd50b0e2561280c9eaa604843ade0.tar.gz
piscine_cpp-a92013c92bfcd50b0e2561280c9eaa604843ade0.tar.bz2
piscine_cpp-a92013c92bfcd50b0e2561280c9eaa604843ade0.zip
Fixing missleading indentation error from clang++ on Linux
Diffstat (limited to 'cpp05')
-rw-r--r--cpp05/ex02/ShrubberyCreationForm.cpp2
-rw-r--r--cpp05/ex02/ShrubberyCreationForm.hpp4
-rw-r--r--cpp05/ex02/main.cpp78
3 files changed, 81 insertions, 3 deletions
diff --git a/cpp05/ex02/ShrubberyCreationForm.cpp b/cpp05/ex02/ShrubberyCreationForm.cpp
index aa9d5a4..70bc570 100644
--- a/cpp05/ex02/ShrubberyCreationForm.cpp
+++ b/cpp05/ex02/ShrubberyCreationForm.cpp
@@ -6,7 +6,7 @@
/* By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/19 13:45:45 by cacharle #+# #+# */
-/* Updated: 2020/11/17 13:23:52 by cacharle ### ########.fr */
+/* Updated: 2020/11/17 16:36:09 by charles ### ########.fr */
/* */
/* ************************************************************************** */
diff --git a/cpp05/ex02/ShrubberyCreationForm.hpp b/cpp05/ex02/ShrubberyCreationForm.hpp
index 8c3b7e6..4799d9d 100644
--- a/cpp05/ex02/ShrubberyCreationForm.hpp
+++ b/cpp05/ex02/ShrubberyCreationForm.hpp
@@ -6,7 +6,7 @@
/* By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/19 13:43:27 by cacharle #+# #+# */
-/* Updated: 2020/11/17 13:08:33 by cacharle ### ########.fr */
+/* Updated: 2020/11/17 16:37:56 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,7 +14,9 @@
# define SHRUBBERYCREATIONFORM_HPP
# include <string>
+# include <cstring>
# include <fstream>
+# include <iostream>
# include "Form.hpp"
class ShrubberyCreationForm : public Form
diff --git a/cpp05/ex02/main.cpp b/cpp05/ex02/main.cpp
index 9c14d05..ae272c9 100644
--- a/cpp05/ex02/main.cpp
+++ b/cpp05/ex02/main.cpp
@@ -6,11 +6,13 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/14 18:13:05 by charles #+# #+# */
-/* Updated: 2020/11/17 13:38:07 by cacharle ### ########.fr */
+/* Updated: 2020/11/17 16:35:40 by charles ### ########.fr */
/* */
/* ************************************************************************** */
#include <fstream>
+#include <ctime>
+#include <cstdlib>
#include "Bureaucrat.hpp"
int main()
@@ -23,10 +25,84 @@ int main()
devRandom.close();
}
else
+ {
seed = time(NULL);
+ }
srand(seed);
+ {
+ std::cout << "=============== BUREAUCRAT ===============" << std::endl;
+ std::cout << "############### CREATION" << std::endl;
+ try { Bureaucrat bu("YO", 0); }
+ catch (std::exception& e) { std::cout << e.what() << std::endl; }
+ try { Bureaucrat bu("YO2", 151); }
+ catch (std::exception& e) { std::cout << e.what() << std::endl; }
+
+ Bureaucrat yep("YEP", 1);
+ Bureaucrat yep2(yep);
+ Bureaucrat yep3("SHOULD NOT BE PRINTED", 42);
+ yep3 = yep;
+ std::cout << yep;
+ std::cout << yep2;
+ std::cout << yep3;
+
+ std::cout << "############### DECREMENT" << std::endl;
+ Bureaucrat a("jean", 140);
+ while (true)
+ {
+ try
+ {
+ a.decrementGrade();
+ std::cout << a;
+ }
+ catch (std::exception& e)
+ {
+ std::cout << e.what() << std::endl;
+ break;
+ }
+ }
+
+ std::cout << "############### INCREMENT" << std::endl;
+ Bureaucrat b("didier", 10);
+ while (true)
+ {
+ try
+ {
+ b.incrementGrade();
+ std::cout << b;
+ }
+ catch (std::exception& e)
+ {
+ std::cout << e.what() << std::endl;
+ break;
+ }
+ }
+
+ // Bureaucrat c("baraucrat", 10);
+ // std::cout << "############### SIGN FORM" << std::endl;
+ // Form f4("foo", 150, 1); c.signForm(f4);
+ // Form f3("foo", 10, 1); c.signForm(f3);
+ // Form f2("foo", 9, 1); c.signForm(f2);
+ // Form f1("foo", 1, 1); c.signForm(f1);
+ }
+
+
+ {
+ std::cout << "================= SHRUBERRY CREATION =================" << std::endl;
+
+ }
+
+ std::cout << std::endl;
+
+ {
+ std::cout << "================= PRESIDENTIAL PARDON =================" << std::endl;
+ }
+
+ std::cout << std::endl;
+ {
+ std::cout << "================= ROBOTOMY REQUEST =================" << std::endl;
+ }
return 0;