You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.2 KiB
55 lines
2.2 KiB
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Contact.cpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* 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)
|
|
{
|
|
this->id = id;
|
|
std::cout << "Enter new contact first name:\n";
|
|
std::cin >> this->datas[FIRST];
|
|
std::cout << "Enter new contact last name:\n";
|
|
std::cin >> this->datas[LAST];
|
|
std::cout << "Enter new contact nickname:\n";
|
|
std::cin >> this->datas[NICK];
|
|
std::cout << "Enter new contact number:\n";
|
|
std::cin >> this->datas[NUMBER];
|
|
std::cout << "Enter new contact secret:\n";
|
|
std::cin >> this->datas[SECRET];
|
|
std::cout << std::endl;
|
|
}
|
|
|
|
void Contact::summary()
|
|
{
|
|
std::cout << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
|
|
std::cout << "|";
|
|
std::cout << std::setw(2) << this->id;
|
|
std::cout << "|";
|
|
for (int i = 0; i <= SECRET; i++)
|
|
{
|
|
if (this->datas[i].length() < 10)
|
|
std::cout << std::setw(10) << this->datas[i] << "|";
|
|
else
|
|
std::cout << this->datas[i].substr(0, 9) << "." << "|";
|
|
}
|
|
std::cout << "\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n";
|
|
}
|
|
|
|
void Contact::get()
|
|
{
|
|
std::cout <<"First name : " << this->datas[FIRST] << std::endl;
|
|
std::cout <<"Last name : " << this->datas[LAST] << std::endl;
|
|
std::cout <<"Nick name : " << this->datas[NICK] << std::endl;
|
|
std::cout <<"Phone nb : " << this->datas[NUMBER] << std::endl;
|
|
std::cout <<"Dark secret : " << this->datas[SECRET] << std::endl;
|
|
}
|
|
|