viermentgab isn't a member function of p, so there's no need for the p. at the beginning. Assumng that p and pl are of type objet, just delete the first two characters and you should be alright!
#include <iostream>
#include <string>
usingnamespace std;
class compte
{
public :
char nom_client[100],date_creation[100],adresse[100],Cin[100],num_compt[10];
int gsm,solde;
compte()
{
cout<<"\n";
cout<<"--- la solde initiale du client en Dh : ";
cin>>solde;
cout<<"--- entrer le nom du client : ";
cin>>nom_client;
cout<<"--- entrer la date de creation : ";
cin>>date_creation;
cout<<"--- entrer l'adresse : ";
cin>>adresse;
cout<<"--- entrer votre cin : ";
cin>>Cin;
cout<<"--- entrer le numero du compte : ";
cin>>num_compt;
cout<<"--- entrer le numero du gsm : ";
cin>>gsm;
cout<<"\n";
}
void affiche()
{
cout<<"\n\n";
cout<<" le solde du client est : "<<solde<<"\n";
cout<<" le nom du client est : "<<nom_client<<"\n";
cout<<" la date du creation du compte est : "<<date_creation<<"\n";
cout<<" l'adresse du client est : "<<adresse<<"\n";
cout<<" le numero de Cin du client est : "<<Cin<<"\n";
cout<<" le numero de compte du client est : "<<num_compt<<"\n";
cout<<" le numero de gsm du client est : "<<gsm<<"\n";
cout<<"\n\n";
}
void verser(int n)
{
solde = solde -1 + n;
}
void retrait(int m)
{
solde = solde - m;
}
};
class courant : public compte
{
public :
void recharger_gsm()
{
int gs,n;
cout<<"entrer le num de gsm que vous voulez recharger\n";
cin>>gs;
cout<<"combien voulez-vous recharger ??\n";
cin>>n ;
do
{
cout<<"\n entrer un numero de recharge valable!!!!!!!!! \n";
cin>>n;
cout<<"\n";
}
while(n != 5 & n != 10 & n != 20 & n != 30 & n != 50 & n != 100 & n != 200 );
solde = solde - n ;
cout<<"rechargment de "<<n<<" reussite\n\n";
cout<<"Votre nouveau solde est :\n\n"<<solde;
}
void vierementgab(courant co1,courant co1, int x)
{
co1.solde = co1.solde + x;
co.solde = co.solde - 20;
}
};
int main()
{
int c,i;
courant p,p1;
p.vierementgab(p1,30);
return 0;
}
how to use that fonction so i can have (p.solde = p.solde-20) and (p1.solde = p1.solde + 30)
:) :)
...I take back what I said about vierementgab not being a member function.
I would suggest moving the entire function (lines 76 to 81) to line 84, changing the name of the first argument to co, and making the function's variables pass by reference. Also delete the p. at line 90, and add your p as the first argument.
I probably should look around for other tiny slip-ups, but... :P
They insisted, eh? Somehow I got the feeling that it wouldn't be that simple. >_>
Starting with the original code, at line 76, delete the first argument.
Then at line 80... I originally suggested that you use this, but instead I think I'll just state that for the purposes of this program you can delete the co.s and it should work just fine, as the compiler will know that you're accessing with the member of the object whose function is being called (in your case p). :)