Bonsoir à tous,
Voici mon problème :
Je dois créer une classe patient qui est définie par un nom, un prénom, un numéro de sécurité sociale, une date de naissance, un numéro de téléphone et son groupe sanguin. La saisie et l'affichage des diverses informations fonctionnent sauf pour la date de naissance.... Pouvez-vous m'aider à régler ce problème et à inclure la classe date dans patient ?
Vous en remerciant
Voici mes divers fichiers :
patient.cpp
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 #include <vector> #include <string> #include <iostream> #include <fstream> #include <Windows.h> #include "date.h" using namespace std; class patient // :public medecin { protected: // Attributs string nom_patient; string prenom_patient; int numero_tel; date date_naissance; int numero_social; string grpsanguin; public: patient(string,string,int,int,int, string); ~patient(); void afficherpatient(); void ajouterpatient(); void setprenom_patient(string); string getprenom_patient(); void setnom_patient(string); string getnom_patient(); void setnumero_tel(int); int getnumero_tel(); void setnumero_social(int); int getnumero_social(); void setdate_naissance(date); date getdate_naissance(); void setpgrpsanguin(string); string getgrpsanguin(); };
date.cpp
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 #include "patient.h" #include<iostream> #include <string> #include <Windows.h> #include "date.h" using namespace std; void patient::afficherpatient() { // cabinet::afficher(); cout << "Le nom du patient est : " << this->nom_patient << endl; cout << "Le prénom du patient est : " << this->prenom_patient << endl; cout << "Le numero de telephone du patient est : " << this->numero_tel << endl; cout << "La date de naissance du patient est : " << this->date_naissance << endl; cout << "Le numero de sécurité sociale du patient est : " << this->numero_social << endl; } patient::patient(string prenom_pat,string nom_pat,int numero_pat, int date_nai, int numero_soc, string grpsang) { //manque date de naissance prenom_patient = prenom_pat; nom_patient = nom_pat; numero_tel = numero_pat; date_naissance=date_nai; numero_social = numero_soc; grpsanguin = grpsang; } patient::~patient() { cout << "Le patient à été détruit " << endl; }
date.h
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 #include "date.h" using namespace std; #include<iostream> #include <string> #include <Windows.h> void date::saisir(void) { char c; //c contiendra le caractere de separation, sans rien tester cout<<"entrez la date au format jj/mm/aaaa : "; cin>>jour>>c>>mois>>c>>an; } void date::afficher(void) { cout<<"le patient est né le :"<<jour<<"/"<<mois<<"/"<<an; }
main.cpp
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 #include <vector> #include <string> #include <iostream> #include <fstream> #include <Windows.h> class date { private: int jour,mois,an; public: int get_jour(void); //{return jour;} int get_mois(void); //{return mois;} int get_an(void); //{return an;} void saisir(void); void afficher(void); };
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 #include <iostream> using namespace std; #include "patient.h" #include "date.h" #include <Windows.h> #include <string> #include <cstdio> int main() { SetConsoleOutputCP( CP_UTF8 ); patient v("loukou", "loutre", 0547245, 10/1/1979, 23544125962, "AB"); v.afficherpatient(); patient w(); string nom_patient; string prenom_patient; int numero_tel; date date_naissance; int numero_social; string grpsanguin; cout << "Tapez le nom du patient : "; cin >> nom_patient; cout << "Tapez le prénom du patient : "; cin >> prenom_patient; cout << "Tapez le numero tel patient : "; cin >> numero_tel; cout << "Tapez la date de naissance du patient au format jj/mm/aaaa: "; cin >> date_naissance; cout << "Tapez le numero de sécurité sociale patient : "; cin >> numero_social; cout << "Tapez le groupe sang du patient : "; cin >> grpsanguin; patient e(nom_patient, prenom_patient, numero_tel, date_naissance, numero_social, grpsanguin); e.afficherpatient(); }
Partager