update: fixed the debug mode and the hour now with color

This commit is contained in:
Raphael 2024-10-15 00:34:03 +02:00
parent 9d476992bc
commit 513f0a44ea
3 changed files with 20 additions and 16 deletions

View file

@ -6,12 +6,11 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <iostream>
/**
* @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();
}
}

View file

@ -6,22 +6,22 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <iostream>
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;
}

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <ctime>
#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"