Slt tout le monde,
voila j ai un probleme avec ceci :
int main()
{
std::vector <Client*> x(1);
int choix;
disMenuPrinc();
cin>>choix;
switch ( choix )
{
case 2:
disMenuCl();
int choix2;
cin>>choix2;
switch ( choix2 )
{
case 1:
string n=addNewClientNom();
string pr=addNewClientPrenom();
string a=addNewClientAdresse();
string v=addNewClientVille();
string p=addNewClientPays();
string ab=addNewClientAbon();
if (ab == "oui")
{
int typabon;
cout<<"Type d'abonnement : ";
cin>>typabon;
ClientAbonne c(n,pr,a,v,p,typabon);
//tabClient.push_back(&c);
x[0] = &c;
x[0]->afficher();
}
else
{
Client c(n,pr,a,v,p);
//tabClient.push_back(&c);
x[0] = &c;
x[0]->afficher();
}
x[0]->afficher();
break;
}
break;
}
x[0]->afficher();
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Les 3 premiers x[0]->afficher()
; fonctionne sans probleme par contre le quatrième fonctionne pas, il coupe l'execution.
Je vous joins afficher() et les fonction de demande de saisie.
Merci pour votre aide,
Heleos
******************************************************************
void Client::afficher()
{
cout<<"ok"<<endl;
system("pause");
cout<<"Nom : "<<nom<<endl<<"Prenom : "<<prenom<<endl
cout<<"Adresse : "<<adresse<<endl<<"Ville : "<<ville<<endl
cout<<"Pays : "<<pays<<endl;
}
static string addNewClientNom()
{
string a;
char ligne[81];
cout<<"Entrez le nom : ";
cin.getline(ligne,80);
cin.getline(ligne,80); a=ligne; cout<<endl;
return a;
}
static string addNewClientPrenom()
{
string a;
char ligne[81];
cout<<"Entrez le prénom : ";
cin.getline(ligne,80) ;a=ligne; cout<<endl;
return a;
}
static string addNewClientAdresse()
{
string a;
char ligne[81];
cout<<"Entrez l'adresse : ";
cin.getline(ligne,80) ;a=ligne; cout<<endl;
return a;
}
static string addNewClientVille()
{
string a;
char ligne[81];
cout<<"Entrez la ville : ";
cin.getline(ligne,80) ;a=ligne; cout<<endl;
return a;
}
static string addNewClientPays()
{
string a;
char ligne[81];
cout<<"Entrez le pays : ";
cin.getline(ligne,80) ;a=ligne; cout<<endl;
return a;
}
static string addNewClientAbon()
{
string a;
cout<<"Abonné (oui/non) : ";
cin>>a;
return a;
}