0% ont trouvé ce document utile (0 vote)
37 vues5 pages

Code

Transféré par

kewouchristianjoel2003
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats TXT, PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
37 vues5 pages

Code

Transféré par

kewouchristianjoel2003
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats TXT, PDF, TXT ou lisez en ligne sur Scribd

#include <iostream>

#include<cstring>
#include<vector>

using namespace std;


class AbstractPersonnelHopital
{
protected:
string NomPersonnel;
int salaire;
string grade;
public:

//CONSTRUCTEUR PAR DEFAUT


AbstractPersonnelHopital()
{
this->salaire=0;
this->grade="";
this->NomPersonnel="";

}
// CONSTRUCTEUR PAR INITIALISATION
PersonnelHopital(int salaire,string nomPersonnel,string grade)
{
this->salaire=salaire;
this->grade=grade;
this->nomPersonnel=nomPersonnel;
virtual void
creerUnNouveauPersonel()=0;
};
// ACCESSEURS
int getSalaire()
{
return this->salaire;
}
string getGrade()
{
return this->grade;
}
//MODIFICATEURS

void setNomPersonnel(string NomPersonnel)

{ this-NomPersonnel=NomPersonnel;
}
void setGrade(string grade)
{
this->grade=grade;
}
void setSalaire(int salaire)
{
this->salaire=salaire;
};
class Docteur:public AbstractPersonnelHopital
{
private :
string specialite;
public:
// constructeur par defaut
Docteur()
{
this->specialite="";
}
//constructeur par initialisation
Docteur(string specialite)
{
this->specialite=specialite;
}
//LES ACCESSEURS
string getSpecialite()
{
return this->specialite;
}
//modificateurs
void setSpecialite(string specialite)
{
this->specialite=specialite;
}
};
class infirmiere:public AbstractPersonnelHopital
{
private :
string typesoins;
public:
// constructeur par defaut
infirmiere()
{
this->typesoins="";
}
//constructeur par initialisation
infirmiere(string typesoins)
{
this->typesoins=typesoins;
}
//LES ACCESSEURS
string getTypesoins()
{
return this->typesoins;
}
//modificateurs
void setTypesoins(string typesoins)
{
this->typesoins=typesoins;
}
};
class consultation
{
private:
string prescription;
string motif;
int date;
public:
// CONSTRUCTEUR PAR DEFAUT
consultation()
{
this->date=0;
this->motif="";
this->prescription="";
}
// CONSTRUCTEUR PAR INITIALISATION
Patient (int date,string motif,string prescription)
{
this->prescription=prescription;
this->date=date;
this->motif=motif;
};
// ACCESSEURS
int getDate()
{
return this->date;
}
string getPrescription()
{
return this->prescription;
}
string getMotif()
{
return this->motif;
}
//MODIFICATEURS
void setPrescription(string prescription)

{ this->prescription=prescription;
}
void setMotif(string motif)
{
this->motif=motif;
}
void setDate(int date)
{
this->date=date;
};
class patient
{
private:
string nompatient;
string maladie;
int age;
public:
// CONSTRUCTEUR PAR DEFAUT
patient()
{
this->age=0;
this->maladie="";
this->nompatient="";

}
// CONSTRUCTEUR PAR INITIALISATION
Patient (int age,string nompatient,string maladie)
{
this->maladie=maladie;
this->nompatient=nompatient;
this->age=age;
};
// ACCESSEURS
int getAge()
{
return this->age;
}
string getMaladie()
{
return this->maladie;
}
string getNompatient()
{
return this->nompatient;
}
//MODIFICATEURS

void setNompatient(string NomPatient)

{ this->nompatient=nompatient;

}
void setMaladie(string maladie)
{
this->maladie=maladie;
}
void setAge(int age)
{
this->age=age;
};
//CLASSE POUR GERER LA LISTE DES PATIENTS
class gestionnairepatients
{
private:
vector<patient>patients;
public:
void ajouterPatient()
{
string nompatient, maladie;
int age;
cout<<"entrez le nom du patient:";
cin>>nompatient;
cout<<"entrez l'age du patient:";
cin>>age;
cout<<"entrez maladie du patient:";
cin>>maladie;
patient nouveauPatient(nompatient,age,maladie);
patients.push-back(nouveauPatient);
cout<<"le patient a ete effectivement ajouter"<<endl;
}
void afficherPatient()
{
if(patients.empty())
{
cout<<"aucun patient n'est enregistre."<<endl;
}
else{cout<<"listes des patients:"<< endl;
for (const auto&patient:patients)
{cout<<"nomPatient:"<<patient.nompatient<<";age:"<<patient.age<<",maladie:"<<patien
t.maladie<<endl;}
}
void supprimerPatient()
{
if(patients.empty()){cout<<"aucun patient n'est
enregistre:"<<endl;}
else{int index;
cout<<"entrez l'indice du patient a supprimer:";
cin>>index;}
if(index>=0&&index<patients.size())
{
patients.erase(patients.begin()+index;
cout<<"le patient a effectivement ete supprimer."<<endl;)
}
else{
cout<<"indice incorrect."endl;
}}}
};
int main(){
gestionnairePatient
gestionnaire;
int choix;
do{cout << "==gestion des patients==" << endl;
cout<<"1.ajouter un patient"<<endl;
cout<<"2.afficher les patients"<<endl;
cout<<"3.supprimer un patient"<<endl;
cout<<"choix:";
cin>>choix;
switch(choix)
{case 1:
gestionnaire.ajouterpatient();
break;
case 2:
gestionnaire.afficherpatient();
break;
case 3:
gestionnaire.supprimerpatient();
break;
default:
cout<<"choix incorrect."<<endl;}
cout<<endl;
}while(choix!=4);
return 0;
}

Vous aimerez peut-être aussi