mirror of
https://github.com/Ladebeze66/cpp-partie-1.git
synced 2026-11-09 13:17:15 +01:00
ccp
This commit is contained in:
18
cpp01/ex00/.vscode/c_cpp_properties.json
vendored
Normal file
18
cpp01/ex00/.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "linux-gcc-x64",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "${default}",
|
||||
"cppStandard": "${default}",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"compilerArgs": [
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
24
cpp01/ex00/.vscode/launch.json
vendored
Normal file
24
cpp01/ex00/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C/C++ Runner: Debug Session",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false,
|
||||
"cwd": "/home/fgras-ca/Bureau/fgras-ca/CPP/cpp01/ex00",
|
||||
"program": "/home/fgras-ca/Bureau/fgras-ca/CPP/cpp01/ex00/build/Debug/outDebug",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
59
cpp01/ex00/.vscode/settings.json
vendored
Normal file
59
cpp01/ex00/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"C_Cpp_Runner.cCompilerPath": "gcc",
|
||||
"C_Cpp_Runner.cppCompilerPath": "g++",
|
||||
"C_Cpp_Runner.debuggerPath": "gdb",
|
||||
"C_Cpp_Runner.cStandard": "",
|
||||
"C_Cpp_Runner.cppStandard": "",
|
||||
"C_Cpp_Runner.msvcBatchPath": "",
|
||||
"C_Cpp_Runner.useMsvc": false,
|
||||
"C_Cpp_Runner.warnings": [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wpedantic",
|
||||
"-Wshadow",
|
||||
"-Wformat=2",
|
||||
"-Wcast-align",
|
||||
"-Wconversion",
|
||||
"-Wsign-conversion",
|
||||
"-Wnull-dereference"
|
||||
],
|
||||
"C_Cpp_Runner.msvcWarnings": [
|
||||
"/W4",
|
||||
"/permissive-",
|
||||
"/w14242",
|
||||
"/w14287",
|
||||
"/w14296",
|
||||
"/w14311",
|
||||
"/w14826",
|
||||
"/w44062",
|
||||
"/w44242",
|
||||
"/w14905",
|
||||
"/w14906",
|
||||
"/w14263",
|
||||
"/w44265",
|
||||
"/w14928"
|
||||
],
|
||||
"C_Cpp_Runner.enableWarnings": true,
|
||||
"C_Cpp_Runner.warningsAsError": false,
|
||||
"C_Cpp_Runner.compilerArgs": [],
|
||||
"C_Cpp_Runner.linkerArgs": [],
|
||||
"C_Cpp_Runner.includePaths": [],
|
||||
"C_Cpp_Runner.includeSearch": [
|
||||
"*",
|
||||
"**/*"
|
||||
],
|
||||
"C_Cpp_Runner.excludeSearch": [
|
||||
"**/build",
|
||||
"**/build/**",
|
||||
"**/.*",
|
||||
"**/.*/**",
|
||||
"**/.vscode",
|
||||
"**/.vscode/**"
|
||||
],
|
||||
"C_Cpp_Runner.useAddressSanitizer": false,
|
||||
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
||||
"C_Cpp_Runner.useLeakSanitizer": false,
|
||||
"C_Cpp_Runner.showCompilationTime": false,
|
||||
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
||||
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
||||
}
|
||||
64
cpp01/ex00/Makefile
Normal file
64
cpp01/ex00/Makefile
Normal file
@@ -0,0 +1,64 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# ::: :::::::: #
|
||||
# Makefile :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2023/12/24 13:55:45 by fgras-ca #+# #+# #
|
||||
# Updated: 2023/12/24 13:59:56 by fgras-ca ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
LOGO = @echo " __, ____, ____, ____, ____ ____, ___, ____,";\
|
||||
echo "(-| (-/_| (-| \ (-|_, (-|__) (-|_, (- / (-|_,";\
|
||||
echo " _|__, _/ |, _|__/ _|__, _|__) _|__, _/__, _|__,";\
|
||||
echo "( ( ( ( ( ( ( ("
|
||||
|
||||
DEF_COLOR = \033[0m
|
||||
GRAY = \033[0;90m
|
||||
RED = \033[0;91m
|
||||
GREEN = \033[0;92m
|
||||
YELLOW = \033[0;93m
|
||||
BLUE = \033[0;94m
|
||||
MAGENTA = \033[0;95m
|
||||
CYAN = \033[0;96m
|
||||
WHITE = \033[0;97m
|
||||
ORANGE = \033[38;5;214m
|
||||
|
||||
NAME = zombie
|
||||
|
||||
SRC = newZombie.cpp \
|
||||
main.cpp \
|
||||
randomChump.cpp \
|
||||
Zombie.cpp \
|
||||
|
||||
OBJS = ${SRC:.cpp=.o}
|
||||
|
||||
CC = c++
|
||||
CFLAGS = -Wall -Werror -Wextra -std=c++98
|
||||
RM = rm -f
|
||||
|
||||
all : $(NAME)
|
||||
|
||||
$(NAME) : $(OBJS)
|
||||
@echo "$(RED)Compilation zombie... $(DEF_COLOR)"
|
||||
$(CC) $(CFLAGS) $(OBJS) -g -o $(NAME)
|
||||
@echo "$(GREEN)Compilation complete. $(ORANGE)Type "./zombie" to execute the program!!$(DEF_COLOR)"
|
||||
$(LOGO)
|
||||
|
||||
clean :
|
||||
@echo "$(RED)Deleating files objects... $(DEF_COLOR)"
|
||||
$(RM) $(OBJS)
|
||||
@echo "$(GREEN)files deleted!! $(DEF_COLOR)"
|
||||
$(LOGO)
|
||||
|
||||
fclean : clean
|
||||
@echo "$(RED)Delete program name... $(DEF_COLOR)"
|
||||
$(RM) $(NAME)
|
||||
@echo "$(GREEN)File program deleted!! $(DEF_COLOR)"
|
||||
$(LOGO)
|
||||
|
||||
re : fclean all
|
||||
|
||||
.PHONY : all clean fclean re
|
||||
37
cpp01/ex00/Zombie.cpp
Normal file
37
cpp01/ex00/Zombie.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Zombie.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/24 13:31:01 by fgras-ca #+# #+# */
|
||||
/* Updated: 2023/12/24 14:06:52 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Zombie.hpp"
|
||||
|
||||
Zombie::Zombie(void)
|
||||
{
|
||||
std::cout << "\033[32m";
|
||||
std::cout << "Constructor called" << std::endl;
|
||||
std::cout << "\033[0m";
|
||||
}
|
||||
|
||||
Zombie::~Zombie(void)
|
||||
{
|
||||
std::cout << "\033[31m";
|
||||
std::cout << "Destructor called" << std::endl;
|
||||
std::cout << "\033[0m";
|
||||
}
|
||||
|
||||
void Zombie::announce(void)
|
||||
{
|
||||
std::cout << this->name << ": BraiiiiiiinnnZ..." << std::endl;
|
||||
}
|
||||
|
||||
void Zombie::setname(std::string name)
|
||||
{
|
||||
this->name = name;
|
||||
}
|
||||
33
cpp01/ex00/Zombie.hpp
Normal file
33
cpp01/ex00/Zombie.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Zombie.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/24 13:23:44 by fgras-ca #+# #+# */
|
||||
/* Updated: 2023/12/24 13:30:20 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef ZOMBIE_HPP
|
||||
# define ZOMBIE_HPP
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class Zombie
|
||||
{
|
||||
public:
|
||||
Zombie(void);
|
||||
~Zombie(void);
|
||||
void announce(void);
|
||||
void setname(std::string name);
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
Zombie* newZombie(std::string name);
|
||||
void randomChump(std::string name);
|
||||
|
||||
#endif
|
||||
BIN
cpp01/ex00/Zombie.o
Normal file
BIN
cpp01/ex00/Zombie.o
Normal file
Binary file not shown.
26
cpp01/ex00/main.cpp
Normal file
26
cpp01/ex00/main.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/24 13:52:26 by fgras-ca #+# #+# */
|
||||
/* Updated: 2023/12/24 14:04:53 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Zombie.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
Zombie *heapZombie = newZombie("HeapZombie");
|
||||
heapZombie->announce();
|
||||
delete heapZombie;
|
||||
std::cout << "\033[31m";
|
||||
std::cout << "HeapZombie Deleted!!" << std::endl << std::endl;
|
||||
std::cout << "\033[0m";
|
||||
randomChump("StackZombie");
|
||||
|
||||
return (0);
|
||||
}
|
||||
BIN
cpp01/ex00/main.o
Normal file
BIN
cpp01/ex00/main.o
Normal file
Binary file not shown.
20
cpp01/ex00/newZombie.cpp
Normal file
20
cpp01/ex00/newZombie.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* newZombie.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/24 13:38:34 by fgras-ca #+# #+# */
|
||||
/* Updated: 2023/12/24 13:46:55 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Zombie.hpp"
|
||||
|
||||
Zombie* newZombie(std::string name)
|
||||
{
|
||||
Zombie *z = new Zombie();
|
||||
z->setname(name);
|
||||
return (z);
|
||||
}
|
||||
BIN
cpp01/ex00/newZombie.o
Normal file
BIN
cpp01/ex00/newZombie.o
Normal file
Binary file not shown.
20
cpp01/ex00/randomChump.cpp
Normal file
20
cpp01/ex00/randomChump.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* randomChump.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/24 13:23:25 by fgras-ca #+# #+# */
|
||||
/* Updated: 2023/12/24 13:50:16 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Zombie.hpp"
|
||||
|
||||
void randomChump(std::string name)
|
||||
{
|
||||
Zombie z;
|
||||
z.setname(name);
|
||||
z.announce();
|
||||
}
|
||||
BIN
cpp01/ex00/randomChump.o
Normal file
BIN
cpp01/ex00/randomChump.o
Normal file
Binary file not shown.
BIN
cpp01/ex00/zombie
Executable file
BIN
cpp01/ex00/zombie
Executable file
Binary file not shown.
Reference in New Issue
Block a user