Bonjour,
J'ai fais un code d'un programme qui permet de saisir les informations du personnel dans une entreprise ( employé,cadre), mais mon code comporte beaucoup d'erreurs surtout aux niveau des constructeurs , pourvez vous m'aider ?
Merci d'avance
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
 
class Personnel
{
    int NCI;
    char Nom[20];
    char Prenom[20];
    public:
    Personnel();
    Personnel(int nc,char *nm,char *pr);
    ~Personnel();
    void saisie();
    void affichage();
};
Personnel::Personnel()
{
    NCI=125;
    strcpy(Nom,"");
    strcpy(Prenom,"");
}
Personnel::Personnel(int nc,char *nm,char *pr)
{
    NCI=nc;
    strcpy(Nom,nm);
    strcpy(Prenom,pr);
}
Personnel::~Personnel()
{
    cout<<"Ceci est un destructeur de la classe Personnel"<<endl;
}
void Personnel::saisie()
{
    cout<<"Entrez le numero de la carte d'identité"<<endl;
    cin>>NCI;
    cout<<"Entrez votre Nom"<<endl;
    cin>>Nom;
    cout<<"Entrez votre Prenom"<<endl;
    cin>>Prenom;
 
}
void Personnel::affichage()
{
    cout<<"NCI= "<<NCI<<endl;
    cout<<"Nom= "<<Nom<<endl;
    cout<<"Prenom= "<<Prenom<<endl;
}
class Employe:public Personnel
{
    float nb_h,tarif;
    public:
    Employe();
    Employe(int nc,char *nm,char *pr,float nh,float,tar);
    ~Employe();
    void saisie();
    void affichage();
 
 
};
Employe::Employe()
{
    nb_h=0;
    tarif=10;
}
Employe::Employe(int nc,char *nm,char *pr,float nh,float tar):Personnel(nc,nm,pr)
{
    tarif=tar;
    nb_h=nh;
}
Employe::~Employe()
{
    cout<<"Ceci est un destructeur de la classe Employ\x82"<<endl;
 
}
void saisie::Employe()
{
    Personnel::saisie();
    cout<<"Entrez le nb_h "<<endl;
    cin>>nb_h;
    cout<<"Entrez le tarif"<<endl;
    cin>>tarif;
}
void affichage::Employe()
{
    Personnel::affichage();
    cout<<"nb_h= "<<nb_h;
    cout<<"tarif= "<<tarif;
}
class Cadre:public Employe
{
    float salaire,prime;
    public:
    Cadre();
    Cadre(int nc,char *nm,char *pr,float sal,float pri);
    ~Cadre();
    void saisie();
    void affichage();
 
};
Cadre::Cadre()
{
    salaire=100;
    prime=0;
}
Cadre::Cadre(int nc,char *nm,char *pr,float sal,float pri):Personnel(nc,nm,pr)
{
    salaire=sal;
    prime=pri;
}
Cadre::~Cadre()
{
    cout<<"Ceci est un destructeur de la classe Cadre"<<endl;
}
void saisie::Cadre()
{
    Personnel::saisie();
    cout<<"Entrez le salaire"<<endl;
    cin>>salaire;
    cout<<"Entrez la prime"<<endl;
    cin>>prime;
}
void affichage::Cadre()
{
    Personnel::affichage();
    cout<<"Salaire= "<<salaire;
    cout<<"Prime= "<<prime;
}
void main()
{
    clrscr();
    cout<<"saisie une personne"<<endl;
    Personnel p;
    p.saisie();
    p.affichage();
    cout<<"saisie cadre"<<endl;
    Cadre c;
    c.saisie();
    c.affichage();
    cout<<"saisie employ\x82"<<endl;
    Employe e;
    e.saisie();
    e.affichage();
    getch();
}