From 6b4d73c432962c56c45dd6ddeccc78e085809c9f Mon Sep 17 00:00:00 2001 From: jopierron Date: Tue, 29 Mar 2022 11:25:54 +0000 Subject: [PATCH] Update Contact.cpp --- src/Contact.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Contact.cpp b/src/Contact.cpp index 001d269..84582a6 100644 --- a/src/Contact.cpp +++ b/src/Contact.cpp @@ -6,8 +6,6 @@ using namespace std; using namespace reseau; -// list::iterator it = find(lesContacts.begin(), lesContacts.end(), personne) - Contact::Contact(const Personne& Proprietaire): Proprietaire{Proprietaire} { cout << "Contact créé " << Proprietaire << "\n"; } @@ -64,23 +62,30 @@ bool Contact::supprimerContact(const Personne& unContact){ } } - -void Contact::envoyerMessage(std::string texte, Personne p){ - +void Contact::afficherContactDirect() { + cout << lesContacts.size() << " Les contacts directs de " << this->Proprietaire << " sont : "; + for(list::const_iterator it = lesContacts.cbegin(); it != lesContacts.cend(); ++it){ + if(it==lesContacts.cbegin()) + cout << **it; + else + cout << ", " << **it; + } + cout << "\n"; } -// string recevoirMessage(std::string texte, Personne p) +void Contact::afficherContactIndirect() { + cout << lesContacts.size() << " Les contacts directs et indirects de " << this->Proprietaire << " sont : "; + if(lesContacts.size()==0) + cout << " Aucun contact "; + cout << "\n"; +} ostream& reseau::operator<<(ostream& os, Personne p){ - return os << p.getNom() << " " << p.getPrenom() << " " << p.getNumTel(); + return os << p.getPrenom(); } bool reseau::operator==(reseau::Personne p1, reseau::Personne p2){ - if(p1.getNom()==p2.getNom()){ - if(p1.getPrenom()==p2.getPrenom()){ - if(p1.getNumTel()==p2.getNumTel()) - return true; - } - } + if(p1.getPrenom()==p2.getPrenom()) + return true; return false; }