1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| #include <stdafx.h>
#include <iostream>
using namespace std;
void main()
{
int i,rien,choix,t1,t2;
char nom[80],tel[10],Nnom[30],Ntel[10],NTelF[10],NMail[50];
struct repertoire
{
char Nom[20] ;
char Prenom[20] ;
char NumTelFixe[11] ;
char NumPortable[11];
char Mail[50];
};
repertoire rep[100]= {{"myara","ruben","0101010101","0202020202","rm@hotmail.com"},
{"sejourne","laurent","0303030303","0404040404","ls@hotmail.com"},
{"bustori","christophe","0505050505","0606060606","bc@hotmail.com"},
{"melodie","mafi","0707070707","0808080808","mm@hotmail.com"}};
cout<<"pour afficher l'integralité du repertoire tape 1"<<"\n";
cout<<"pour rechercher a partir du nom tapez 2"<<"\n";
cout<<"pour rechercher a partir du tel fixe tapez 3"<<"\n";
cout<<"pour inserer un nouveau contact tapez 4"<<"\n";
cout<<"pour supprimer un contact tapez 5"<<"\n";
cin>>choix;
if (choix==1)
{
for(i=0;i<4;i++)/
cout<<rep[i].Nom<<" "<<rep[i].Prenom<<" "<<rep[i].NumTelFixe<<" "<<rep[i].NumPortable<<" "<<rep[i].Mail<<" "<<"\n";
}
if (choix==2)
{
cout<<"entrez le nom rechercher"<<"\n";
cin>>nom;
for(i=0;i<4;i++)
{
if (strcmp(nom,rep[i].Nom) == 0)
{
cout<<rep[i].Nom<<" "<<rep[i].Prenom<<" "<<rep[i].NumTelFixe<<" "<<rep[i].NumPortable<<" "<<rep[i].Mail<<" "<<"\n";;
t1=1;
}
}
if (t1!=1)
{
cout<<"ce nom n'existe pas"<<"\n";
}
}
if (choix==3)
{
cout<<"entrez le tel fixe du contact recherché"<<"\n";
cin>>tel;
for(i=0;i<4;i++)
{
if (strcmp(tel,rep[i].NumTelFixe) == 0)
{
cout<<rep[i].Nom<<" "<<rep[i].Prenom<<" "<<rep[i].NumTelFixe<<" "<<rep[i].NumPortable<<" "<<rep[i].Mail<<" "<<"\n";
t2=1;
}
}
if (t2!=1)
{
cout<<"ce tel n'existe pas"<<"\n";
}
if (choix==4)
{
cout<<"entrez le nom du nouveau contact"<<"\n";
cin>>Nnom;
cout<<"entrez le tel du nouveau contact"<<"\n";
cin>>Ntel;
cout<<"entrez le tel fixe du nouveau contact"<<"\n";
cin>>NTelF;
cout<<"entrez l'adresse email du nouveau contact"<<"\n";
cin>>NMail;
}
}
cin>>rien;
} |
Partager