djibeson-howard
Messages postés6Date d'inscriptiondimanche 29 décembre 2013StatutMembreDernière intervention 4 janvier 2014
-
4 janv. 2014 à 19:39
Supafresh
Messages postés40Date d'inscriptionsamedi 1 février 2014StatutMembreDernière intervention 7 août 2014
-
14 mars 2014 à 18:21
Bonjour,
j'ai commencé mon projet mais je suis caller au stockage aidez moi s'il vous plait voici mon code
class contact
{
private:
string nom;
string prenom;
int numero;
public:
string getNom(){return nom;}
string getPrenom(){return prenom;}
int getNumero(){return numero;}
int addContact(contact *TC[], string Nm, int nbp)
{
int i,t;
string tel;
// Insertion du nom par ordre alphabétique
TC[i+1] = TC[i];
i = i + 1;
TC[i] = (contact*)malloc(sizeof(contact));
TC[i]->nom = Nm;
cout<<" Veuillez saisir le numero de Telephone : "<< endl;
cin>>tel;
TC[i]->numero = tel;
cout<<"INSCRIPTION EFFECTUE"<<Nm;
nbp++;
return(nbp);
}
};
class Ami : public contact
{
private:
string date_naissance;
string adresse_postale;
string adresse_mail;
public:
string getdN(){return date_naissance;}
string getBP(){return adresse_postale;}
string getMail(){return adresse_mail;}
int addami(contact *TC[], string Nm, int nbp,string dNaissance,string BP,string mail)
{
int i,t;
string tel;
// Insertion du nom par ordre alphabétique
TC[i+1] = TC[i];
i = i + 1;
TC[i] = (contact*)malloc(sizeof(contact));
TC[i]->nom = Nm;
printf(" Veuillez saisir le numero de Telephone : ");
cin>>tel;
TC[i]->numero = tel;
int addContact(contact *TC[], string zlNom, int nbp);
int SUPPRIMER(contact *TC[], int nbp, int r);
void CONSULTER(contact *TP[], int r);
void AFFICHER(contact *TP[], int nbp);
int RECHERCHER(contact *TP[], string zlNom[], int nbp);
void QUITTER(contact *TP[], int nbp);
void PAUSE();
contact::affichecontact();
cout<<"Date de naissance: "<<date_naissance<<endl;
cout<<"BP: "<<adresse_postale<<endl;
cout<<"E-mail: "<<adresse_mail<<endl;
}
};
//Repertoire
class repertoire{
private:
contact *t;
int N,n;//N=taille max, n=taille courante.
public:
repertoire(){}
repertoire(int Tmax){
t=new contact[N=Tmax];
n=0;
}
void saisir(string nom, string prenom, string numero){
contact *c;
cout<<"Donner le nom du contact: "<<endl;
cin>>nom;
cout<<"Donner le prenom du contact: "<<endl;
cin>>prenom;
cout<<"Donner le numero du contact: "<<endl;
cin>>numero;
c=new contact(nom,prenom,numero);
}
void addcontact(contact a){
if (n<N){
t[n++]=a;
}
}
void afficherepertoire(){
for (int i=0; i<n; i++)
t[i].affichecontact();
}
};
int main()
{
cout<<"--------------------------------------------------------------------"<<endl;
cout<<"1:----------------|Creer un nouveau repertoire|---------------------"<<endl;
cout<<"2:-----------------|Ajouter un nouveau contact|---------------------"<<endl;
cout<<"3:-------------------|Supprimer un contact|-------------------------"<<endl;
cout<<"4:-----------------|Afficher tous les contacts|---------------------"<<endl;
cout<<"5:-------------|Afficher tous les contacts(avec tri)|---------------"<<endl;
cout<<"6:---------------|Afficher tous les amis(avec tri)|-----------------"<<endl;
cout<<"7:-------------------|Rechercher un contact|------------------------"<<endl;
cout<<"8:--------------------|Vider le repertoire|-------------------------"<<endl;
cout<<"0:-------------------------|Quitter|--------------------------------"<<endl;
cout<<"---------------------|COPYRIGHT MAF 2013|-------------------------"<<endl;
cout<<"-------------------------|Faites un choix|--------------------------"<<endl;
int n=9;
cin>>n;
switch(n)
{
case 1 :{
cout<<"Donner la taille max du repertoire: "<<endl;
int taille_max;
cin>>taille_max;
repertoire r(taille_max);
contact c1("BA","Aly","77");*/
contact *c2= new contact ("fd","sdrr","767","10-3-244","23","dfe@dff");
r.addcontact(c1);
r.addcontact(c2);
}
break;
case 2 :{
repertoire r;
contact *c;
void repertoire::saisir(string nom, string prenom, string numero);
r.addcontact(c);
r.afficherepertoire();
}
break;
case 3 :;
break;
case 4 :;
break;
case 5 :;
break;
case 6 :;
break;
case 7 :;
break;
case 8 :;
break;
case 9 :;
break;
case 10 :;
break;*/
}
system("PAUSE");
return EXIT_SUCCESS;
}
Merci... D'avance
Ajouter un commentaire - Modifier - Lien (#2)
Supafresh
Messages postés40Date d'inscriptionsamedi 1 février 2014StatutMembreDernière intervention 7 août 20143 14 mars 2014 à 18:21
Bonjour, pour que quelqu'un puisse relire ton code sans trop de problème, tu devrais séparer tes classes en contact.c et contact.h ... Mettre des indentations dans ton code et utilise la balise <code> pour envoyer ton code.