diff --git a/.vscode/settings.json b/.vscode/settings.json index 65e1ec0..02a222c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,75 @@ { - "makefile.extensionOutputFolder": "./.vscode" + "makefile.extensionOutputFolder": "./.vscode", + "files.associations": { + "thread": "cpp", + "list": "cpp", + "__bit_reference": "cpp", + "__bits": "cpp", + "__config": "cpp", + "__debug": "cpp", + "__errc": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__mutex_base": "cpp", + "__node_handle": "cpp", + "__nullptr": "cpp", + "__split_buffer": "cpp", + "__string": "cpp", + "__threading_support": "cpp", + "__tree": "cpp", + "__tuple": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "exception": "cpp", + "initializer_list": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "locale": "cpp", + "map": "cpp", + "memory": "cpp", + "mutex": "cpp", + "new": "cpp", + "optional": "cpp", + "ostream": "cpp", + "ratio": "cpp", + "set": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "unordered_map": "cpp", + "variant": "cpp", + "vector": "cpp", + "__functional_base": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "utility": "cpp" + } } \ No newline at end of file diff --git a/bin/exe b/bin/exe new file mode 100755 index 0000000..c80622c Binary files /dev/null and b/bin/exe differ diff --git a/obj/Contact.o b/obj/Contact.o new file mode 100644 index 0000000..af755a5 Binary files /dev/null and b/obj/Contact.o differ diff --git a/obj/Personne.o b/obj/Personne.o new file mode 100644 index 0000000..74e4481 Binary files /dev/null and b/obj/Personne.o differ diff --git a/obj/Personne2.o b/obj/Personne2.o new file mode 100644 index 0000000..9ee8c51 Binary files /dev/null and b/obj/Personne2.o differ diff --git a/obj/main.o b/obj/main.o new file mode 100644 index 0000000..98ddc2a Binary files /dev/null and b/obj/main.o differ diff --git a/src/Contact.cpp b/src/Contact.cpp index 3752029..db54a0a 100644 --- a/src/Contact.cpp +++ b/src/Contact.cpp @@ -7,7 +7,7 @@ using namespace std; using namespace reseau; Contact::Contact(const Personne& Proprietaire): Proprietaire{Proprietaire} { - cout << "Contact créé " << Proprietaire << "\n"; + // cout << "Contact créé " << Proprietaire << "\n"; } const Personne& Contact::getProprio() const { @@ -16,7 +16,7 @@ const Personne& Contact::getProprio() const { bool Contact::ajouterContact(const Personne& unContact){ if(lesContacts.empty()){ - cout << "Contact ajouté " << unContact <<"\n"; + // cout << "Contact ajouté " << unContact <<"\n"; lesContacts.push_back(&unContact); return true; } @@ -31,7 +31,7 @@ bool Contact::ajouterContact(const Personne& unContact){ return false; } else { - cout << "Contact ajouté " << unContact <<"\n"; + // cout << "Contact ajouté " << unContact <<"\n"; lesContacts.push_back(&unContact); return true; } diff --git a/src/Personne.cpp b/src/Personne.cpp index f820145..79b882b 100644 --- a/src/Personne.cpp +++ b/src/Personne.cpp @@ -5,7 +5,7 @@ using namespace std; using namespace reseau; Personne::Personne(const std::string& prenom):prenom{prenom}{ - cout << "Personne créée " << prenom <<"\n"; + // cout << "Personne créée " << prenom <<"\n"; } // Personne::Personne(): numPers{0}{ diff --git a/src/Personne2.cpp b/src/Personne2.cpp index b8b7205..93299e0 100644 --- a/src/Personne2.cpp +++ b/src/Personne2.cpp @@ -1,10 +1,14 @@ #include +#include #include "Personne2.h" using namespace std; using namespace reseau2; +list Personne::listePersonneAll{}; + Personne::Personne(const string& prenom): prenom{prenom}{ + listePersonneAll.emplace_back(*this); cout << prenom << " créé\n"; } @@ -13,23 +17,25 @@ const string& Personne::getPrenom() const { } bool Personne::ajoutListe(const Personne& unePersonne) { - if(lesPersonnes.empty()){ + if(allPerson.empty()){ cout << "Personne ajoutée " << unePersonne <<"\n"; - lesPersonnes.push_back(unePersonne); + allPerson.push_back(unePersonne); return true; } if(unePersonne.getPrenom()==this->prenom) return false; else { cout << "Personne ajoutée " << unePersonne <<"\n"; - lesPersonnes.push_back(unePersonne); + allPerson.push_back(unePersonne); return true; } } void Personne::affichListe() { - for(list::const_iterator it2 = lesPersonnes.cbegin(); it2 != lesPersonnes.cend(); ++it2) - cout << *it2 << "\n"; + cout<<"("<getPrenom()<<") : "; + for(list::const_iterator it2 = allPerson.cbegin(); it2 != allPerson.cend(); ++it2) + cout << *it2 << " "; + cout << "\n"; } diff --git a/src/Personne2.h b/src/Personne2.h index 77a7512..e99bde9 100644 --- a/src/Personne2.h +++ b/src/Personne2.h @@ -2,21 +2,27 @@ #define PERSONNE2_HPP #include #include +#include namespace reseau2 { class Personne { std::string prenom; + std::list allPerson; + // std::map> map; public: + static std::list listePersonneAll; Personne(const std::string& prenom); bool ajoutListe(const Personne& unePersonne); void affichListe(); const std::string& getPrenom() const; ~Personne(); - }; - std::list lesPersonnes{}; - std::ostream& operator<<(std::ostream& os, reseau2::Personne p); - bool operator==(reseau2::Personne p1, reseau2::Personne p2); + + + + }; + std::ostream& operator<<(std::ostream& os, Personne p); + bool operator==(Personne p1, Personne p2); } #endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index f660d59..5fb29cd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,55 +12,117 @@ using this_thread::sleep_for; void technique1(){ reseau2::Personne p1{"Bob"}; reseau2::Personne p2{"Domi"}; + reseau2::Personne p3{"Anne"}; + reseau2::Personne p4{"Elie"}; + reseau2::Personne p5{"Cali"}; + reseau2::Personne p6{"Samuel"}; + reseau2::Personne p7{"Elena"}; + reseau2::Personne p8{"Baptiste"}; + reseau2::Personne p9{"Franck"}; + reseau2::Personne p10{"Agathe"}; + reseau2::Personne p11{"Louna"}; + reseau2::Personne p12{"Theo"}; + reseau2::Personne p13{"Morgane"}; + reseau2::Personne p14{"Thibault"}; + reseau2::Personne p15{"Gwen"}; + + p1.ajoutListe(p2); + p1.ajoutListe(p5); + p1.ajoutListe(p4); + p3.ajoutListe(p1); + p3.ajoutListe(p2); + p4.ajoutListe(p5); + p4.ajoutListe(p6); + p5.ajoutListe(p4); + p6.ajoutListe(p7); + p6.ajoutListe(p9); + p7.ajoutListe(p3); + p8.ajoutListe(p2); + p9.ajoutListe(p6); + p9.ajoutListe(p11); + p10.ajoutListe(p7); + p10.ajoutListe(p8); + p11.ajoutListe(p15); + p12.ajoutListe(p10); + p13.ajoutListe(p11); + p14.ajoutListe(p12); + p14.ajoutListe(p13); + p15.ajoutListe(p9); + + p1.affichListe(); + p2.affichListe(); + p3.affichListe(); + p4.affichListe(); + p5.affichListe(); + p6.affichListe(); + p7.affichListe(); + p8.affichListe(); + p9.affichListe(); + p10.affichListe(); + p11.affichListe(); + p12.affichListe(); + p13.affichListe(); + p14.affichListe(); + p15.affichListe(); + + + + for (reseau2::Personne p : p1.listePersonneAll ) + { + cout< Contacts; +void technique3(){ + reseau::Personne p1{"Bob"}; + reseau::Personne p2{"Domi"}; + reseau::Personne p3{"Anne"}; + reseau::Personne p4{"Elie"}; + reseau::Personne p5{"Cali"}; + reseau::Personne p6{"Samuel"}; + reseau::Personne p7{"Elena"}; + reseau::Personne p8{"Baptiste"}; + reseau::Personne p9{"Franck"}; + reseau::Personne p10{"Agathe"}; + reseau::Personne p11{"Louna"}; + reseau::Personne p12{"Theo"}; + reseau::Personne p13{"Morgane"}; + reseau::Personne p14{"Thibault"}; + reseau::Personne p15{"Gwen"}; + list Contacts; // cout << "----------\n"; - Contact c1{p1}; + reseau::Contact c1{p1}; Contacts.push_back(&c1); - Contact c2{p2}; + reseau::Contact c2{p2}; Contacts.push_back(&c2); - Contact c3{p3}; + reseau::Contact c3{p3}; Contacts.push_back(&c3); - Contact c4{p4}; + reseau::Contact c4{p4}; Contacts.push_back(&c4); - Contact c5{p5}; + reseau::Contact c5{p5}; Contacts.push_back(&c5); - Contact c6{p6}; + reseau::Contact c6{p6}; Contacts.push_back(&c6); - Contact c7{p7}; + reseau::Contact c7{p7}; Contacts.push_back(&c7); - Contact c8{p8}; + reseau::Contact c8{p8}; Contacts.push_back(&c8); - Contact c9{p9}; + reseau::Contact c9{p9}; Contacts.push_back(&c9); - Contact c10{p10}; + reseau::Contact c10{p10}; Contacts.push_back(&c10); - Contact c11{p11}; + reseau::Contact c11{p11}; Contacts.push_back(&c11); - Contact c12{p12}; + reseau::Contact c12{p12}; Contacts.push_back(&c12); - Contact c13{p13}; + reseau::Contact c13{p13}; Contacts.push_back(&c13); - Contact c14{p14}; + reseau::Contact c14{p14}; Contacts.push_back(&c14); - Contact c15{p15}; + reseau::Contact c15{p15}; Contacts.push_back(&c15); // cout << "----------\n"; c1.ajouterContact(p2); @@ -234,12 +296,11 @@ int technique3(){ technique3(); break; } - sleep_for(8s); - system("clear"); + // sleep_for(8s); + // system("clear"); technique3(); break; case 3 : - return 0; break; } }