#include #include #include #include "PhoneBook.hpp" Contact read_contact() { std::string first_name; std::string last_name; std::string nickname; std::string phone_number; std::cout << "first_name: "; std::getline(std::cin, first_name); std::cout << "last_name: "; std::getline(std::cin, last_name); std::cout << "nickname: "; std::getline(std::cin, nickname); std::cout << "phone_number: "; std::getline(std::cin, phone_number); return Contact(first_name, last_name, nickname, phone_number); } int main() { std::string command; Contact new_contact; PhoneBook phone_book; phone_book = PhoneBook(); while (true) { std::cout << "command: "; std::getline(std::cin, command); if (command == "ADD") { new_contact = read_contact(); if (new_contact.isValid()) phone_book.add_contact(new_contact); else std::cerr << "Contact Error !" << std::endl; } else if (command == "SEARCH") { phone_book.display_contacts(); } else if (command == "EXIT") { return (0); } } return (0); }