d07 ex01 ok

This commit is contained in:
hugogogo
2022-03-10 19:12:00 +01:00
parent 3433fafd87
commit a38d7184e3
7 changed files with 198 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
#ifndef DECREMENT_HPP
# define DECREMENT_HPP
# include <iostream>
# include <string>
template< typename T >
void Decrement(T & e) {
--e;;
}
#endif

11
d07/ex01/headers/Iter.hpp Normal file
View File

@@ -0,0 +1,11 @@
#ifndef ITER_HPP
# define ITER_HPP
template< typename T, typename F >
void Iter(T *arr, size_t len, F & f)
{
for (size_t i = 0; i < len; i++)
f(arr[i]);
}
#endif

View File

@@ -0,0 +1,13 @@
#ifndef PRINT_HPP
# define PRINT_HPP
# include <iostream>
# include <string>
template< typename T >
void Print(T const & e) {
std::cout << "[" << e << "]\n";
}
#endif

View File

@@ -0,0 +1,14 @@
#ifndef TOUPPER_HPP
# define TOUPPER_HPP
# include <iostream>
# include <string>
# include <cctype>
template< typename T >
void ToUpper(T & e) {
e = toupper(e);
}
#endif

25
d07/ex01/headers/colors.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef COLORS_H
# define COLORS_H
# define GRAY "\e[0;30m"
# define RED "\e[0;31m"
# define GREEN "\e[0;32m"
# define YELLOW "\e[0;33m"
# define BLUE "\e[0;34m"
# define PURPLE "\e[0;35m"
# define CYAN "\e[0;36m"
# define WHITE "\e[0;37m"
# define B_GRAY "\e[1;30m"
# define B_RED "\e[1;31m"
# define B_GREEN "\e[1;32m"
# define B_YELLOW "\e[1;33m"
# define B_BLUE "\e[1;34m"
# define B_PURPLE "\e[1;35m"
# define B_CYAN "\e[1;36m"
# define B_WHITE "\e[1;37m"
# define RESET "\e[0m"
#endif