diff --git a/Makefile b/Makefile index 6e27d81..735fee6 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ bin/exe: $(OBJ) $(CC) $(OBJ) -o $@ # génération des .o à partir des .cpp et .hpp crrespondants : -obj/%.o: src/%.cpp +obj/%.o: src/%.cpp $(CC) $(CFLAGS) -c $< -o $@ #nettoyage : destruction des .o et de l'exécutable @@ -24,3 +24,4 @@ clean: rm obj/*.o bin/exe + diff --git a/bin/exe b/bin/exe index c80622c..23f5fa4 100755 Binary files a/bin/exe and b/bin/exe differ diff --git a/obj/Contact.o b/obj/Contact.o index af755a5..e7d04d7 100644 Binary files a/obj/Contact.o and b/obj/Contact.o differ diff --git a/obj/Personne2.o b/obj/Personne2.o deleted file mode 100644 index 9ee8c51..0000000 Binary files a/obj/Personne2.o and /dev/null differ diff --git a/obj/main.o b/obj/main.o index 98ddc2a..7f20318 100644 Binary files a/obj/main.o and b/obj/main.o differ diff --git a/src/Contact.cpp b/src/Contact.cpp index 0b08dba..c6c7342 100644 --- a/src/Contact.cpp +++ b/src/Contact.cpp @@ -1,7 +1,6 @@ #include #include "Contact.hpp" -#include -#include + using namespace std; using namespace reseau; @@ -35,7 +34,6 @@ bool Contact::ajouterContact(const Personne& unContact){ lesContacts.push_back(&unContact); return true; } - return true; } bool Contact::rechercher(const Personne& unContact){ diff --git a/src/Contact.hpp b/src/Contact.hpp index e055474..278b34c 100644 --- a/src/Contact.hpp +++ b/src/Contact.hpp @@ -11,6 +11,7 @@ namespace reseau{ std::list lesContacts{}; void Recursive(std::list Contacts, std::set* set); public: + Contact(const reseau::Personne& Proprietaire); const Personne& getProprio() const; bool ajouterContact(const reseau::Personne& unContact); diff --git a/src/Contact3.cpp b/src/Contact3.cpp index d648304..1b3c6ef 100644 --- a/src/Contact3.cpp +++ b/src/Contact3.cpp @@ -1,7 +1,5 @@ #include #include "Contact3.hpp" -#include -#include using namespace std; using namespace reseau2; diff --git a/src/Personne3.cpp b/src/Personne3.cpp index 596f0ea..9a501bd 100644 --- a/src/Personne3.cpp +++ b/src/Personne3.cpp @@ -34,10 +34,13 @@ bool Personne::peutCommuniquerA(const Personne &p) const { unordered_set visited; queue pile; pile.push(this); + cout<<"test1"; while (!pile.empty()) { - const Personne* front = pile.front(); pile.pop(); - for (const Personne* perso : front->contacts->getValue()) { + cout<<"test2"; + for (const Personne* perso : pile.front()->contacts->getValue()) { + cout<<"test3"; + exit(0); if (perso == &p) { cout << this->prenom << " peut communiquer avec " << p.getPrenom() << "\n"; return true; diff --git a/src/main.cpp b/src/main.cpp index 8ce71e0..acb7b57 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,4 @@ #include -#include #include "Personne3.hpp" #include "Contact3.hpp" #include "Personne.hpp" @@ -133,8 +132,8 @@ int main() { pp15.ajtContact(pp9); - vector Repertoire = { c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15 }; - vector Repertoire2 = { pp1, pp2, pp3, pp4, pp5, pp6, pp7, pp8, pp9, pp10, pp11, pp12, pp13, pp14, pp15}; + vector Repertoire {c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15}; + vector Repertoire2 {pp1, pp2, pp3, pp4, pp5, pp6, pp7, pp8, pp9, pp10, pp11, pp12, pp13, pp14, pp15}; /* Début du menu et initialisation des variables qu'on utilisera pour chaque partie de celui-ci @@ -189,6 +188,9 @@ int main() { */ Repertoire[persChoix-1].afficherContactIndirect(Contacts); break; + default: + cout<<"Erreur : Tapez un nombre correct\n"; + exit(0); } } else{ @@ -209,6 +211,9 @@ int main() { Repertoire[i].afficherContactIndirect(Contacts); } break; + default: + cout<<"Erreur : Tapez un nombre correct\n"; + exit(0); } } break; @@ -219,12 +224,17 @@ int main() { */ main(); break; + default: + cout<<"Erreur : Tapez un nombre correct\n"; + exit(0); } break; case 3: - main(); break; + default: + cout<<"Erreur : Tapez un nombre correct\n"; + exit(0); } /* On attend 8 secondes après l'affichage de nos commandes puis on effache tout, pour avoir un ternimal vide entre chaque utilisation @@ -236,16 +246,24 @@ int main() { cin >> persEnvoie; cout << "\n"; cout << "\n Choisissez le destinataire : \n\n--------------------\n(1)\tBob\n(2)\tDomi\n(3)\tAnne\n(4)\tElie\n(5)\tCali\n(6)\tSamuel\n(7)\tElena\n(8)\tBaptiste\n(9)\tFranck\n(10)\tAgathe\n(11)\tLouna\n(12)\tTheo\n(13)\tMorgane\n(14)\tThibault\n(15)\tGwen\n--------------------\n\n Tapez le numéro de la personne : "; - cin >> persDest; + cin >> persDest; + cout<<"test"; cout << "\n"; - // Repertoire2[persEnvoie-1].peutCommuniquerA(Repertoire2[persDest-1]); Erreur Seg + //Personne f= Repertoire2[persEnvoie-1] + + Repertoire2[persEnvoie-1].peutCommuniquerA(Repertoire2[persDest-1]); main(); break; case 3 : /* le return sert pour arrêter le programme lorsqu'on demande l'exit sur le premier menu*/ exit(0); /* */ break; + default: + cout<<"Erreur, tapez un chiffre correct\n"; + exit(0); + } - + + }