recherche erreur seg

main
Maxence LANONE 3 years ago
parent 346ed20bfd
commit 834edc8562

@ -24,3 +24,4 @@ clean:
rm obj/*.o bin/exe

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,7 +1,6 @@
#include <iostream>
#include "Contact.hpp"
#include <list>
#include <algorithm>
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){

@ -11,6 +11,7 @@ namespace reseau{
std::list<const reseau::Personne*> lesContacts{};
void Recursive(std::list<Contact*> Contacts, std::set<const reseau::Personne*>* set);
public:
Contact(const reseau::Personne& Proprietaire);
const Personne& getProprio() const;
bool ajouterContact(const reseau::Personne& unContact);

@ -1,7 +1,5 @@
#include <iostream>
#include "Contact3.hpp"
#include <list>
#include <algorithm>
using namespace std;
using namespace reseau2;

@ -34,10 +34,13 @@ bool Personne::peutCommuniquerA(const Personne &p) const {
unordered_set<const Personne*> visited;
queue<const Personne*> 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;

@ -1,5 +1,4 @@
#include <iostream>
#include <thread>
#include "Personne3.hpp"
#include "Contact3.hpp"
#include "Personne.hpp"
@ -133,8 +132,8 @@ int main() {
pp15.ajtContact(pp9);
vector<Contact> Repertoire = { c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15 };
vector<reseau2::Personne> Repertoire2 = { pp1, pp2, pp3, pp4, pp5, pp6, pp7, pp8, pp9, pp10, pp11, pp12, pp13, pp14, pp15};
vector<reseau::Contact> Repertoire {c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15};
vector<reseau2::Personne> 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);
}
}

Loading…
Cancel
Save