feat(09): starting the ex00

This commit is contained in:
Raphael 2025-04-08 13:36:23 +02:00
parent 2305cb2c87
commit 1cf3760638
5 changed files with 193 additions and 4 deletions

View file

@ -0,0 +1,13 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* BitcoinExchange.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/08 13:34:34 by rparodi #+# #+# */
/* Updated: 2025/04/08 13:34:36 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* BitcoinExchange.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/08 12:18:18 by rparodi #+# #+# */
/* Updated: 2025/04/08 12:19:08 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <iostream>
#define CLR_RESET "\033[0m"
#define CLR_BLACK "\033[0;30m"
#define CLR_RED "\033[0;31m"
#define CLR_GREEN "\033[0;32m"
#define CLR_YELLOW "\033[0;33m"
#define CLR_BLUE "\033[0;34m"
#define CLR_MAGENTA "\033[0;35m"
#define CLR_CYAN "\033[0;36m"
#define CLR_WHITE "\033[0;37m"
#define CLR_GOLD "\033[38;5;220m"
#define CLR_GREY "\033[38;5;240m"

127
cpp09/ex00/Makefile Normal file
View file

@ -0,0 +1,127 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
# Updated: 2025/04/08 12:15:25 by rparodi ### ########.fr #
# #
# **************************************************************************** #
# Variables
# Name
NAME = btc
# Commands
CXX = c++
RM = rm -rf
# Flags
# Mandatory flags for 42
CXXFLAGS = -Werror -Wextra -Wall -std=c++98 -I./includes/
# Flags to have the dependences (can be removed for correction)
CXXFLAGS += -MMD
# Flags to have the debug (can be removed for correction)
DEBUG = -g3
# DEBUG += -fsanitize=address
CXXFLAGS += $(DEBUG)
# Sources
SRC = BitcoinExchange.cpp \
main.cpp
# Objects
OBJDIRNAME = ./build
OBJ = $(addprefix $(OBJDIRNAME)/,$(SRC:.cpp=.o))
# Colors
GREEN = \033[32m
GREY = \033[0;90m
RED = \033[0;31m
GOLD = \033[38;5;220m
END = \033[0m
# Rules
# All (make all)
all: header $(NAME) footer
# Bonus (make bonus)
bonus: header $(OBJ) footer
@mkdir -p $(OBJDIRNAME)
@printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n'
@$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ)
# Clean (make clean)
clean:
@printf '$(GREY) Removing $(END)$(RED)Objects$(END)\n'
@printf '$(GREY) Removing $(END)$(RED)Objects Folder$(END)\n'
@$(RM) $(OBJDIRNAME)
# Clean (make fclean)
fclean: clean
@printf '$(GREY) Removing $(END)$(RED)Program$(END)\n'
@$(RM) $(NAME)
@echo ""
# Restart (make re)
re: header fclean all
# Dependences for all
$(NAME): $(OBJ)
@mkdir -p $(OBJDIRNAME)
@printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n'
@$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ)
# Creating the objects
$(OBJDIRNAME)/%.o: %.cpp
@mkdir -p $(dir $@)
@printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n'
@$(CXX) $(CXXFLAGS) -o $@ -c $<
# Header
header:
@clear
@printf '\n\n'
@printf '$(GOLD) ******* ****** ******* $(END)\n'
@printf '$(GOLD) ****** *** ******* $(END)\n'
@printf '$(GOLD) ******* * ******* $(END)\n'
@printf '$(GOLD) ****** ******* $(END)\n'
@printf '$(GOLD) ******* ******* $(END)\n'
@printf '$(GOLD) ******************* ******* * $(END)\n'
@printf '$(GOLD) ******************* ******* *** $(END)\n'
@printf '$(GOLD) ****** ******* ****** $(END)\n'
@printf '$(GOLD) ****** $(END)\n'
@printf '$(GOLD) ****** $(END)\n'
@printf '$(GREY) Made by rparodi$(END)\n\n'
# Footer
footer:
@printf "\n"
@printf "$(GOLD) ,_ _,$(END)\n"
@printf "$(GOLD) | \\___//|$(END)\n"
@printf "$(GOLD) |=6 6=|$(END)\n"
@printf "$(GOLD) \\=._Y_.=/$(END)\n"
@printf "$(GOLD) ) \` ( ,$(END)\n"
@printf "$(GOLD) / \\ (('$(END)\n"
@printf "$(GOLD) | | ))$(END)\n"
@printf "$(GOLD) /| | | |\\_//$(END)\n"
@printf "$(GOLD) \\| |._.| |/-\`$(END)\n"
@printf "$(GOLD) '\"' '\"'$(END)\n"
@printf ' $(GREY)The compilation is$(END) $(GOLD)finish$(END)\n $(GREY)Have a good $(END)$(GOLD)correction !$(END)\n'
clangd:
@echo -e \
"CompileFlags:\n" \
" Add:\n" \
" - \"-std=c++98 -Wall -Wextra -Werror\"\n" \
" - \"-I"$(shell pwd)"/includes\"\n" \
" - \"-xc++\"\n" \
> .clangd
# Phony
.PHONY: all bonus clean fclean re clangd
-include ${OBJ:.o=.d}

21
cpp09/ex00/main.cpp Normal file
View file

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/08 12:15:32 by rparodi #+# #+# */
/* Updated: 2025/04/08 12:21:16 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "BitcoinExchange.hpp"
int main(int argc, char *argv[]) {
if (argc != 2) {
std::cerr << CLR_RED << "Usage: " << argv[0] << " <filename>" << CLR_RESET << std::endl;
} else {
}
}