/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Contact.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/13 13:29:20 by narnaud #+# #+# */ /* Updated: 2022/06/13 16:48:13 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ #include "Contact.hpp" Contact::Contact(){} void Contact::set(int id) { _id = id; std::cout << "Enter new contact first name:\n"; while (_datas[FIRST] == "") std::cin >> _datas[FIRST]; std::cout << "Enter new contact last name:\n"; while (_datas[LAST] == "") std::cin >> _datas[LAST]; std::cout << "Enter new contact nickname:\n"; while (_datas[NICK] == "") std::cin >> _datas[NICK]; std::cout << "Enter new contact number:\n"; while (_datas[NUMBER] == "") std::cin >> _datas[NUMBER]; std::cout << "Enter new contact secret:\n"; while (_datas[SECRET] == "") std::cin >> _datas[SECRET]; } void Contact::summary() { std::cout << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"; std::cout << "|"; std::cout << std::setw(2) << _id; std::cout << "|"; for (int i = 0; i <= SECRET; i++) { if (_datas[i].length() < 10) std::cout << std::setw(10) << _datas[i] << "|"; else std::cout << _datas[i].substr(0, 9) << "." << "|"; } std::cout << "\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n"; } void Contact::get() { std::cout <<"First name : " << _datas[FIRST] << std::endl; std::cout <<"Last name : " << _datas[LAST] << std::endl; std::cout <<"Nick name : " << _datas[NICK] << std::endl; std::cout <<"Phone nb : " << _datas[NUMBER] << std::endl; std::cout <<"Dark secret : " << _datas[SECRET] << std::endl; }