salut a tous,
j'ai un répertoire a faire et j'ai un problème avec la 4eme fonction de ce répertoire qui est censé ajouter un contact.
je suis sous vc++ , ca compile mais ca ne fonctionne pas.
Merci d'avance!

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include <stdafx.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
 
 
using namespace std;
 
void main()
{
 
 
 
int i,rien,choix,t1,t2,rep2,NbContact,pos;
char nom[80],tel[10],Nnom[30],Ntel[10],NTelF[10],NMail[50],NPrenom[30];
 
while (rep2!=2)
{
struct repertoire
		{
       char Nom[20] ;
       char Prenom[20] ;
       char NumTelFixe[11] ;
       char NumPortable[11];
       char Mail[50];
       };
 
repertoire rep[100]= {{"bustori","christophe","0505050505","0606060606","bc@hotmail.com"},
                     {"melodie","mafi","0707070707","0808080808","mm@hotmail.com"},
                     {"myara","ruben","0101010101","0202020202","rm@hotmail.com"},
                     {"sejourne","laurent","0303030303","0404040404","ls@hotmail.com"}};
 cout<<"***************************************************************"<<"\n"<<"\n";
 cout<<"***************************************************************"<<"\n"<<"\n";
 cout<<"pour afficher l'integralit\x82 du repertoire tape 1"<<"\n"<<endl;
 cout<<"pour rechercher a partir du nom tapez 2"<<"\n"<<endl;
 cout<<"pour rechercher a partir du tel fixe tapez 3"<<"\n"<<endl;
 cout<<"pour inserer un nouveau contact tapez 4"<<"\n"<<endl;
 cout<<"pour supprimer un contact tapez 5"<<"\n"<<endl;
 cout<<"***************************************************************"<<"\n"<<"\n";
 cout<<"***************************************************************"<<"\n"<<"\n";
 cin>>choix;
 NbContact=4;
 
 if (choix==1)
 {
	 for(i=0;i<NbContact;i++)
 
 	cout<<rep[i].Nom<<" "<<rep[i].Prenom<<" "<<rep[i].NumTelFixe<<" "<<rep[i].NumPortable<<" "<<rep[i].Mail<<" "<<"\n"<<endl;
 
 
 }
 
if (choix==2)
{
	cout<<"entrez le nom recherch\x82"<<"\n"<<endl;
 	cin>>nom;
 
   for(i=0;i<NbContact;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"<<endl;
 
         }
}
 
if (choix==3)
{
	cout<<"entrez le tel fixe du contact recherch\x82"<<"\n"<<endl;
 	cin>>tel;
 
   for(i=0;i<NbContact;i++)
    {
       if (stricmp(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"<<endl;   
         }
}
 
   if (choix==4)
   {
	   cout<<"entrez le nom du nouveau contact"<<endl;
	   cin>>Nnom;
	   cout<<"entrez le prenom du nouveau contact"<<endl;
	   cin>>NPrenom;
	   cout<<"entrez le tel du nouveau contact"<<endl;
	   cin>>Ntel;
	   cout<<"entrez le tel fixe du nouveau contact"<<endl;
	   cin>>NTelF;
	   cout<<"entrez l'adresse email du nouveau contact"<<endl;
	   cin>>NMail;
 
for(i=0;i<NbContact;i++)
     {
        if (stricmp(Nnom,rep[i].Nom)>0)
	    {
			pos=0;
		   pos=pos+1;
	    }
     }
 
NbContact=NbContact+1;
  }
 
strcpy(rep[pos+1].Nom,Nnom);
strcpy(rep[pos+1].Prenom,NPrenom);
strcpy(rep[pos+1].NumTelFixe,NTelF);
strcpy(rep[pos+1].NumPortable,Ntel);
strcpy(rep[pos+1].Mail,NMail);
 
 cout<<"***************************************************************"<<"\n"<<"\n";
 cout<<"tapez 1 si vous voulez continuer et 2 si vous voulez areter"<<endl;;
 cin>>rep2;
}
 
 
}