Salut a tous!
j'ai un probleme avec mon code (un répertoire) ou la pause ne fonctionne pas depuis que j'ai passé en char la variable(rep2) qui récupère la réponse a la dernière question posé a l'utilisateur pour savoir si il veux continuer ou fermer le programme. (mon probleme est donc que le prog. se femre avant qu'il puisse afficher quoi que ce soit)
Merci d'avance.
Voici mon code
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#include <stdafx.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
 
 
using namespace std;
 
void main()
{
 
 
 
int i,rien,choix,t1,t2,NbContact,pos;
char nom[80],tel[10],Nnom[30],Ntel[10],NTelF[10],NMail[50],NPrenom[30],sup[30],rep2[10];
 
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"}};
 
 NbContact=4;
while (rep2=="o")
{
 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;
 
 
 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;
 
	   		 pos=0;
for(i=0;i<NbContact;i++)
     {
        if (stricmp(Nnom,rep[i].Nom)>0)
	    {
		   pos=pos++;
	    }
     }
 
for(i=NbContact;i>=pos;i--)
     {
       strcpy(rep[i+1].Nom,rep[i].Nom);
       strcpy(rep[i+1].Prenom,rep[i].Prenom);
       strcpy(rep[i+1].NumTelFixe,rep[i].NumTelFixe);
       strcpy(rep[i+1].NumPortable,rep[i].NumPortable);
       strcpy(rep[i+1].Mail,rep[i].Mail);
    }
 
strcpy(rep[pos].Nom,Nnom);
strcpy(rep[pos].Prenom,NPrenom);
strcpy(rep[pos].NumTelFixe,NTelF);
strcpy(rep[pos].NumPortable,Ntel);
strcpy(rep[pos].Mail,NMail);
 
NbContact=NbContact+1;
cout<<"le contact a bien été ajout\x82"<<"\n";
  }
 
if (choix==5)
{
	cout<<"entrez le nom du contact a supprim\x82"<<"\n"<<"\n";
	cin>>sup;
 
 
		   		 pos=0;
for(i=0;i<NbContact;i++)
     {
        if (stricmp(sup,rep[i].Nom)>0)
	    {
		   pos=pos++;
	    }
     }
 
for(i=pos;i<NbContact;i++)
     {
       strcpy_s(rep[i].Nom,rep[i+1].Nom);
       strcpy_s(rep[i].Prenom,rep[i+1].Prenom);
       strcpy_s(rep[i].NumTelFixe,rep[i+1].NumTelFixe);
       strcpy_s(rep[i].NumPortable,rep[i+1].NumPortable);
       strcpy_s(rep[i].Mail,rep[i+1].Mail);
    }
cout<<"le contact a bien ete supprim\x82"<<"\n";
}
 cout<<"***************************************************************"<<"\n"<<"\n";
 cout<<"voulez vous continuer? (o/n)"<<endl;;
 cin>>rep2;
}
 
 
}