diff --git a/cpp00/ex01/main.cpp b/cpp00/ex01/main.cpp index d44daf9..155cb01 100644 --- a/cpp00/ex01/main.cpp +++ b/cpp00/ex01/main.cpp @@ -6,12 +6,11 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/20 19:42:14 by rparodi #+# #+# */ -/* Updated: 2024/10/15 00:14:12 by rparodi ### ########.fr */ +/* Updated: 2024/10/15 00:33:56 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "phonebook.hpp" -#include /** * @brief Adding a new contact @@ -85,11 +84,15 @@ int main(void) else i++; } - if (strcmp(input.c_str(), "SEARCH") == 0) + else if (strcmp(input.c_str(), "SEARCH") == 0) + { if (searching(array_contact, i)) std::cerr << RED << "\nError: during the searching process\n" << RESET << std::endl; - if (strcmp(input.c_str(), "EXIT") == 0) + } + else if (strcmp(input.c_str(), "EXIT") == 0) return (0); + else + std::cerr << RED << "\nError: no option reconnise\n" << RESET << std::endl; input.clear(); } } diff --git a/cpp00/ex01/phonebook.cpp b/cpp00/ex01/phonebook.cpp index bf8a69f..31c80a5 100644 --- a/cpp00/ex01/phonebook.cpp +++ b/cpp00/ex01/phonebook.cpp @@ -6,22 +6,22 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/20 19:50:03 by rparodi #+# #+# */ -/* Updated: 2024/10/15 00:13:03 by rparodi ### ########.fr */ +/* Updated: 2024/10/15 00:32:03 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "phonebook.hpp" -#include -void contact::print(void) { +void contact::_debug() { + std::cout << GOLD << "\n\n\tDEBUG MODE ENABLE\n" << RESET << std::endl; std::cout << GREY; - std::cout << "Creation Hour:" << creation_time << std::endl; - std::cout << "First Name:" << first_name << std::endl; - std::cout << "Last Name:" << last_name << std::endl; - std::cout << "Nickname:" << nickname << std::endl; - std::cout << "Number:" << number << std::endl; - std::cout << "Dark Secret:" << dark_secret << std::endl; - std::cout << "ID:" << id << std::endl; - std::cout << RESET; + std::cout << "First Name:\t" << first_name << std::endl; + std::cout << "Last Name:\t" << last_name << std::endl; + std::cout << "Nickname:\t" << nickname << std::endl; + std::cout << "Number:\t\t" << number << std::endl; + std::cout << "Dark Secret:\t" << dark_secret << std::endl; + std::cout << "ID:\t\t" << id << std::endl; + std::cout << "Creation Hour:\t" << creation_time->tm_hour << ":" << creation_time->tm_min << ":" << creation_time->tm_sec << std::endl; + std::cout << RESET << std::endl; } diff --git a/cpp00/ex01/phonebook.hpp b/cpp00/ex01/phonebook.hpp index 06d1502..53d094f 100644 --- a/cpp00/ex01/phonebook.hpp +++ b/cpp00/ex01/phonebook.hpp @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/20 18:59:14 by rparodi #+# #+# */ -/* Updated: 2024/10/15 00:14:00 by rparodi ### ########.fr */ +/* Updated: 2024/10/15 00:26:50 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,6 +20,7 @@ #include #define MENU_TEXT "You're in the main menu:\nHere's the command:\n\t- " << BLUE << "ADD: " << RESET << "To add a new contact\n\t- " BLUE << "SEARCH: " << RESET "To search a contact\n\t- " BLUE << "EXIT: " << RESET "to exit the program" +#define GOLD "\033[38;5;220m" #define GREY "\033[0;90m" #define RED "\033[31m" #define GREEN "\033[32m"