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
| #include <stdafx.h>
#include <iostream>
using namespace std;
void main()
{
int i,rien,choix;
char nom[20];
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 taper 1"<<"\n";
cout<<"pour rechercher a partir du nom taper 2"<<"\n";
cout<<"pour rechercher a partir du tel taper 3"<<"\n";
cout<<"pour inserer un nouveau contact taper 4"<<"\n";
cout<<"pour supprimer un contact taper 5"<<"\n";
cin>>choix;
if (choix=1)
{
for(i=0;i<4;i++)/*une fois l'etape d'ajout de contact réaliser fair un compteur et rendre ce pour dynamique*/
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";
cin>>nom;
for(i=0;i<4;i++)
{
if (strcmp(nom,rep[i].Nom) == 0)
cout<<rep[i].Nom;
else
cout<<"ce nom n'existe pas";
}
}
cout<<"entrez le nom rechercher";
cin>>nom;
cin>>rien;
} |
Partager