@ -1,8 +1,8 @@
# include <iostream>
# include <iostream>
# include <thread>
# include <vector>
# include <thread> /* on récupère thread afin de faire un sleep pour l'esthétique du menu */
# include "Personne.hpp"
# include "Personne.hpp"
# include "Contact.hpp"
# include "Contact.hpp"
# include "Personne2.h"
using namespace std ;
using namespace std ;
using namespace reseau ;
using namespace reseau ;
@ -124,7 +124,11 @@ void technique3(){
Contacts . push_back ( & c14 ) ;
Contacts . push_back ( & c14 ) ;
reseau : : Contact c15 { p15 } ;
reseau : : Contact c15 { p15 } ;
Contacts . push_back ( & c15 ) ;
Contacts . push_back ( & c15 ) ;
// cout << "----------\n";
/*
On place les contacts directs dans une liste de personne qui correspond au r é pertoire de chaque personne
*/
c1 . ajouterContact ( p2 ) ;
c1 . ajouterContact ( p2 ) ;
c1 . ajouterContact ( p5 ) ;
c1 . ajouterContact ( p5 ) ;
c1 . ajouterContact ( p4 ) ;
c1 . ajouterContact ( p4 ) ;
@ -148,165 +152,160 @@ void technique3(){
c14 . ajouterContact ( p13 ) ;
c14 . ajouterContact ( p13 ) ;
c15 . ajouterContact ( p9 ) ;
c15 . ajouterContact ( p9 ) ;
vector < Contact > Repertoire = { c1 , c2 , c3 , c4 , c5 , c6 , c7 , c8 , c9 , c10 , c11 , c12 , c13 , c14 , c15 } ;
int i = 1 ;
Repertoire [ i ] . afficherContactDirect ( ) ;
/*
D é but du menu et initialisation des variables qu ' on utilisera pour chaque partie de celui - ci
*/
int choix , choix2 , choix3 , persChoix ;
int choix , choix2 , choix3 , persChoix ;
cout < < " \n --------------------------------------------------------------- \n | Technique n°3 (1) | Technique n°2 (2) | Sortir (3) | \n --------------------------------------------------------------- \n \n --> " ;
cout < < " \n --------------------------------------------------------------- \n | Technique n°3 (1) | Technique n°2 (2) | Sortir (3) | \n --------------------------------------------------------------- \n \n --> " ;
cin > > choix ;
cin > > choix ;
switch ( choix ) {
switch ( choix ) {
/*
Le cas 1 et le cas 2 feront le m ê me code au d é but donc on appliquera leurs diff é rences plus tard dans un if
*/
case 1 :
case 1 :
case 2 :
case 2 :
cout < < " \n ------------------------------------------------------------- \n | Cas global (1) | Cas individuel (2) | Retour (3) | \n ------------------------------------------------------------- \n \n --> " ;
cout < < " \n ------------------------------------------------------------- \n | Cas global (1) | Cas individuel (2) | Retour (3) | \n ------------------------------------------------------------- \n \n --> " ;
cin > > choix2 ;
cin > > choix2 ;
switch ( choix2 ) {
switch ( choix2 ) {
/*
Le cas 1 et le cas 2 feront le m ê me code au d é but donc on appliquera leurs diff é rences plus tard dans un if
*/
case 1 :
case 1 :
case 2 :
case 2 :
cout < < " \n ------------------------------------------------------------------- \n | Contact Direct (1) | Contact Indirect (2) | Retour (3) | \n ------------------------------------------------------------------- \n \n --> " ;
cout < < " \n ------------------------------------------------------------------- \n | Contact Direct (1) | Contact Indirect (2) | Retour (3) | \n ------------------------------------------------------------------- \n \n --> " ;
cin > > choix3 ;
cin > > choix3 ;
switch ( choix3 ) {
switch ( choix3 ) {
/*
Le cas 1 et le cas 2 feront le m ê me code au d é but donc on appliquera leurs diff é rences plus tard dans un autre switch
*/
case 1 :
case 1 :
case 2 :
case 2 :
/*
On applique en fonction de notre choix2 les m é thodes et l ' affichage voulu , afin d ' é viter des r é p é titions dans les case .
*/
if ( choix2 = = 2 ) {
if ( choix2 = = 2 ) {
cout < < " \n Choisissez la personne que vous voulez regarder : \n \n -------------------- \n (1) \t Bob \n (2) \t Domi \n (3) \t Anne \n (4) \t Elie \n (5) \t Cali \n (6) \t Samuel \n (7) \t Elena \n (8) \t Baptiste \n (9) \t Franck \n (10) \t Agathe \n (11) \t Louna \n (12) \t Theo \n (13) \t Morgane \n (14) \t Thibault \n (15) \t Gwen \n -------------------- \n \n Tapez le numéro de la personne : " ;
cout < < " \n Choisissez la personne que vous voulez regarder : \n \n -------------------- \n (1) \t Bob \n (2) \t Domi \n (3) \t Anne \n (4) \t Elie \n (5) \t Cali \n (6) \t Samuel \n (7) \t Elena \n (8) \t Baptiste \n (9) \t Franck \n (10) \t Agathe \n (11) \t Louna \n (12) \t Theo \n (13) \t Morgane \n (14) \t Thibault \n (15) \t Gwen \n -------------------- \n \n Tapez le numéro de la personne : " ;
cin > > persChoix ;
cin > > persChoix ;
cout < < " \n " ;
cout < < " \n " ;
switch ( choix3 ) {
case 1 :
/*
if ( persChoix = = 1 )
On s é pare les m é thodes que l ' on veut utiliser en fonction de la Technique choisi au d é but dans la variable choix avec un if et un else
c1 . afficherContactDirect ( ) ;
*/
if ( persChoix = = 2 )
if ( choix = = 1 ) {
c2 . afficherContactDirect ( ) ;
/*
if ( persChoix = = 3 )
On applique en fonction de notre choix3 les m é thodes voulu , afin d ' é viter des r é p é titions dans les case .
c3 . afficherContactDirect ( ) ;
*/
if ( persChoix = = 4 )
switch ( choix3 ) {
c4 . afficherContactDirect ( ) ;
case 1 :
if ( persChoix = = 5 )
/*
c5 . afficherContactDirect ( ) ;
En fonction de la personne choisi avec la variable persChoix , il affiche ses contacts directs
if ( persChoix = = 6 )
*/
c6 . afficherContactDirect ( ) ;
Repertoire [ persChoix - 1 ] . afficherContactDirect ( ) ;
if ( persChoix = = 7 )
break ;
c7 . afficherContactDirect ( ) ;
case 2 :
if ( persChoix = = 8 )
/*
c8 . afficherContactDirect ( ) ;
En fonction de la personne choisi avec la variable persChoix , il affiche sa propagation
if ( persChoix = = 9 )
*/
c9 . afficherContactDirect ( ) ;
Repertoire [ persChoix - 1 ] . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 10 )
break ;
c10 . afficherContactDirect ( ) ;
}
if ( persChoix = = 11 )
}
c11 . afficherContactDirect ( ) ;
else {
if ( persChoix = = 12 )
switch ( choix3 ) { /* TEHCNIQUE N°2*/
c12 . afficherContactDirect ( ) ;
case 1 :
if ( persChoix = = 13 )
/*
c13 . afficherContactDirect ( ) ;
En fonction de la personne choisi avec la variable persChoix , il affiche ses contacts directs
if ( persChoix = = 14 )
*/
c14 . afficherContactDirect ( ) ;
Repertoire [ persChoix - 1 ] . afficherContactDirect ( ) ;
if ( persChoix = = 15 )
break ;
c15 . afficherContactDirect ( ) ;
case 2 :
break ;
/*
case 2 :
En fonction de la personne choisi avec la variable persChoix , il affiche sa propagation
if ( persChoix = = 1 )
*/
c1 . afficherContactIndirect ( Contacts ) ;
Repertoire [ persChoix - 1 ] . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 2 )
break ;
c2 . afficherContactIndirect ( Contacts ) ;
}
if ( persChoix = = 3 )
c3 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 4 )
c4 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 5 )
c5 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 6 )
c6 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 7 )
c7 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 8 )
c8 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 9 )
c9 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 10 )
c10 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 11 )
c11 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 12 )
c12 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 13 )
c13 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 14 )
c14 . afficherContactIndirect ( Contacts ) ;
if ( persChoix = = 15 )
c15 . afficherContactIndirect ( Contacts ) ;
break ;
}
}
}
}
else {
else {
switch( choix3 ) {
if ( choix = = 1 ) {
case 1 :
switch ( choix3 ) {
case 1 :
c1 . afficherContactDirect ( ) ;
/*
c2 . afficherContactDirect ( ) ;
On affiche les contacts directs de tout le r é seau
c3 . afficherContactDirect ( ) ;
*/
c4 . afficherContactDirect ( ) ;
for ( long unsigned int i = 0 ; i < Repertoire . size ( ) ; i + + ) {
c5 . afficherContactDirect ( ) ;
Repertoire [ i ] . afficherContactDirect ( ) ;
c6 . afficherContactDirect ( ) ;
}
c7 . afficherContactDirect ( ) ;
break ;
c8 . afficherContactDirect ( ) ;
case 2 :
c9 . afficherContactDirect ( ) ;
/*
c10 . afficherContactDirect ( ) ;
On affiche la propagation de tout le r é seau
c11 . afficherContactDirect ( ) ;
*/
c12 . afficherContactDirect ( ) ;
for ( long unsigned int i = 0 ; i < Repertoire . size ( ) ; i + + ) {
c13 . afficherContactDirect ( ) ;
Repertoire [ i ] . afficherContactIndirect ( Contacts ) ;
c14 . afficherContactDirect ( ) ;
}
c15 . afficherContactDirect ( ) ;
break ;
}
break ;
}
case 2 :
else {
switch ( choix3 ) { /* TEHCNIQUE N°2*/
c1 . afficherContactIndirect ( Contacts ) ;
case 1 :
c2 . afficherContactIndirect ( Contacts ) ;
/*
c3 . afficherContactIndirect ( Contacts ) ;
On affiche les contacts directs de tout le r é seau
c4 . afficherContactIndirect ( Contacts ) ;
*/
c5 . afficherContactIndirect ( Contacts ) ;
for ( long unsigned int i = 0 ; i < Repertoire . size ( ) ; i + + ) {
c6 . afficherContactIndirect ( Contacts ) ;
Repertoire [ i ] . afficherContactDirect ( ) ;
c7 . afficherContactIndirect ( Contacts ) ;
}
c8 . afficherContactIndirect ( Contacts ) ;
break ;
c9 . afficherContactIndirect ( Contacts ) ;
case 2 :
c10 . afficherContactIndirect ( Contacts ) ;
/*
c11 . afficherContactIndirect ( Contacts ) ;
On affiche la propagation de tout le r é seau
c12 . afficherContactIndirect ( Contacts ) ;
*/
c13 . afficherContactIndirect ( Contacts ) ;
for ( long unsigned int i = 0 ; i < Repertoire . size ( ) ; i + + ) {
c14 . afficherContactIndirect ( Contacts ) ;
Repertoire [ i ] . afficherContactIndirect ( Contacts ) ;
c15 . afficherContactIndirect ( Contacts ) ;
}
break ;
break ;
}
}
}
}
}
break ;
break ;
case 3 :
case 3 :
technique3 ( ) ;
/*
les deux prochains case sont l à pour appeler r é cursivement le main et donc notre menu
*/
main ( ) ;
break ;
break ;
}
}
break ;
break ;
case 3 :
case 3 :
technique3 ( ) ;
main ( ) ;
break ;
break ;
}
}
// sleep_for(8s);
/*
// system("clear");
On attend 8 secondes apr è s l ' affichage de nos commandes puis on effache tout , pour avoir un ternimal vide entre chaque utilisation
technique3 ( ) ;
*/
sleep_for ( 8 s ) ;
system ( " clear " ) ;
main ( ) ;
break ;
break ;
case 3 :
case 3 :
/* le return sert pour arrêter le programme lorsqu'on demande l'exit sur le premier menu*/
exit ( 1 ) ; /* */
break ;
break ;
}
}
}
int main ( ) {
technique1 ( ) ;
// technique3();
return 0 ;
}
}