Skip to content

Commit 6a34503

Browse files
authored
Add files via upload
1 parent 506378d commit 6a34503

File tree

8 files changed

+798
-0
lines changed

8 files changed

+798
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
[Project]
2+
FileName=CmplxSurcharge.dev
3+
Name=CmplxSurcharge
4+
Type=1
5+
Ver=2
6+
ObjFiles=
7+
Includes=
8+
Libs=
9+
PrivateResource=
10+
ResourceIncludes=
11+
MakeIncludes=
12+
Compiler=
13+
CppCompiler=
14+
Linker=
15+
IsCpp=1
16+
Icon=
17+
ExeOutput=
18+
ObjectOutput=
19+
LogOutput=
20+
LogOutputEnabled=0
21+
OverrideOutput=0
22+
OverrideOutputName=
23+
HostApplication=
24+
UseCustomMakefile=0
25+
CustomMakefile=
26+
CommandLine=
27+
Folders=
28+
IncludeVersionInfo=0
29+
SupportXPThemes=0
30+
CompilerSet=0
31+
CompilerSettings=0000000000000000001000000
32+
UnitCount=3
33+
34+
[VersionInfo]
35+
Major=1
36+
Minor=0
37+
Release=0
38+
Build=0
39+
LanguageID=1033
40+
CharsetID=1252
41+
CompanyName=
42+
FileVersion=
43+
FileDescription=Developed using the Dev-C++ IDE
44+
InternalName=
45+
LegalCopyright=
46+
LegalTrademarks=
47+
OriginalFilename=
48+
ProductName=
49+
ProductVersion=
50+
AutoIncBuildNr=0
51+
SyncProduct=1
52+
53+
[Unit2]
54+
FileName=codesurcharge.hpp
55+
CompileCpp=1
56+
Folder=
57+
Compile=1
58+
Link=1
59+
Priority=1000
60+
OverrideBuildCmd=0
61+
BuildCmd=
62+
63+
[Unit1]
64+
FileName=codesurcharge.cpp
65+
CompileCpp=1
66+
Folder=
67+
Compile=1
68+
Link=1
69+
Priority=1000
70+
OverrideBuildCmd=0
71+
BuildCmd=
72+
73+
[Unit3]
74+
FileName=main.cpp
75+
CompileCpp=1
76+
Folder=
77+
Compile=1
78+
Link=1
79+
Priority=1000
80+
OverrideBuildCmd=0
81+
BuildCmd=
82+
83+
[Unit5]
84+
FileName=SansNom3
85+
Folder=
86+
Compile=1
87+
Link=1
88+
Priority=1000
89+
OverrideBuildCmd=0
90+
BuildCmd=
91+
92+
[Unit4]
93+
FileName=SansNom3
94+
Folder=
95+
Compile=1
96+
Link=1
97+
Priority=1000
98+
OverrideBuildCmd=0
99+
BuildCmd=
100+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#include<iostream>
2+
#include"codesurcharge.hpp"
3+
#include<cmath>
4+
5+
Complexe::Complexe():Re(0),Im(0){ }
6+
7+
Complexe::Complexe(double i=0):Re(i),Im(0){ }
8+
9+
Complexe::Complexe(double r,double i):Re(r),Im(i){ }
10+
11+
Complexe::Complexe(const Complexe& c):Re(c.Re),Im(c.Im){ }
12+
13+
double Complexe::get_Im(){return Im;}
14+
15+
double Complexe::get_Re(){return Re;}
16+
17+
void Complexe::set_Im(double i){Im=i;}
18+
19+
void Complexe::set_Re(double r){Re=r;}
20+
21+
ostream& operator<<(ostream& co,const Complexe& c){
22+
if(c.Re!=0){
23+
if(c.Im>0){
24+
co<<c.Re<<"+"<<c.Im<<"i";
25+
}else if(c.Im<0){
26+
co<<c.Re<<"-"<<-(c.Im)<<"i";
27+
}
28+
else
29+
co<<c.Re;
30+
}
31+
else{
32+
if(c.Im>0){
33+
co<<c.Im<<"i";
34+
}else if(c.Im<0){
35+
co<<"-"<<-(c.Im)<<"i";
36+
}
37+
else
38+
co<<0;
39+
40+
}
41+
return (co);
42+
}
43+
44+
45+
double Complexe::Module(){
46+
return (sqrt((Re*Re)+(Im*Im)));
47+
}
48+
49+
Complexe Complexe::Conjugue(){
50+
Complexe c(0); //equivalent à
51+
c.Re=Re; //equivalent à
52+
c.Im=-Im; //equivalent à
53+
return c; //equivale,t à return Complexe(Re,-Im); (CONSTRUCTEUR)!!
54+
55+
}
56+
57+
bool Complexe::operator==(const Complexe& c){
58+
return (c.Re==Re && c.Im==Im);
59+
}
60+
61+
bool Complexe::operator!=(const Complexe& c){
62+
return(!(*(this)==c));
63+
}
64+
Complexe Complexe::operator+(const Complexe& c){
65+
return(Complexe(Re+c.Re,Im+c.Im));
66+
}
67+
Complexe Complexe::operator*(const Complexe& c){
68+
return(Complexe(Re*c.Re-Im*c.Im,Im*c.Re+Re*c.Im));
69+
}
70+
71+
72+
istream& operator>>(istream& is,Complexe &c){
73+
cout<<"Saisir la partie reelle ";
74+
is>>c.Re;
75+
cout<<"Saisir la partie imaginaire";
76+
is>>c.Im;
77+
return(is);
78+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using namespace std;
2+
// Conjugué = L'opposé de la partie imaginaire
3+
4+
class Complexe{
5+
double Re,Im;
6+
public :
7+
Complexe();
8+
Complexe(double i);
9+
Complexe(double r,double i);
10+
Complexe(const Complexe&);
11+
double get_Re();
12+
double get_Im();
13+
void set_Re(double);
14+
void set_Im(double);
15+
friend ostream& operator<<(ostream&,const Complexe&);
16+
/* ON DOIT OBLIGATOIREMENT LA DEFINIR COMME FCT EXTERNE !!!
17+
PCK L'OPERANDE A GAUCHE EST DE CLASS OSTREAM
18+
ET L'OPERANDE A DROITE EST DE CLASS COMPLEXE
19+
DONC AVEC COUT<<C1<<C2 ON AURA ERREUR
20+
CAR C1 DOIT ETRE DE TIPE OSTREAM !!!
21+
*/
22+
double Module();
23+
Complexe Conjugue();
24+
bool operator==(const Complexe&);
25+
bool operator!=(const Complexe&);
26+
Complexe operator+(const Complexe&);
27+
Complexe operator*(const Complexe&);
28+
friend istream& operator>>(istream& ,Complexe&);
29+
//COPIE PROFONDE
30+
};
31+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include<iostream>
2+
#include"codesurcharge.hpp"
3+
int main(int argc, char** argv) {
4+
Complexe c(5,-2),d;
5+
cout<<c<<endl;
6+
cout<<"Le module est : "<<c.Module()<<endl;
7+
cout<<"Le conjugue est : ";
8+
cout<<c.Conjugue()<<endl;
9+
cout<<"veuillez saisir le d"<<endl;
10+
cin>>d;
11+
if(c!=d)
12+
cout<<"Ces deux nombres complexes sont different !"<<endl;
13+
else cout<<"c'est deux nombres sont differents !"<<endl;
14+
cout<<"Leur somme est : ";
15+
cout<<c+d<<endl;
16+
cout<<"Leur produit est : ";
17+
cout<<c*d<<endl;
18+
cout<<c<<" et "<<d<<endl;
19+
return 0;
20+
}

Employe.cpp

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#include<iostream>
2+
#include<conio.h>
3+
4+
using namespace std;
5+
6+
class Date{ public:
7+
int j,m,a;
8+
Date(int jour,int mois,int annee):j(jour),m(mois),a(annee){}
9+
Date();
10+
int get_jour(){return(j);}
11+
int get_mois(){return(m);}
12+
int get_annee(){return(a);}
13+
void set_annee(int ann){a=ann;}
14+
void set_mois(int moo){m=moo;}
15+
void set_jour(int jr){j=jr;}
16+
void affiche_dt(Date d){
17+
cout<<d.get_jour()<<"/"<<d.get_mois()<<"/"<<d.get_annee();
18+
}
19+
20+
};
21+
22+
class Employe{
23+
public : Date dt_naiss;
24+
private:
25+
26+
int matricule;
27+
string nom;
28+
string prenom;
29+
30+
char situation;
31+
32+
public:
33+
34+
void setNom(string nm,string prenm){
35+
//Name setter
36+
37+
nom=nm;
38+
prenom=prenm;
39+
}
40+
41+
void setMatricule(int x){
42+
//Marticule setter
43+
matricule=x;
44+
}
45+
46+
void setDate(Date a){
47+
// Birthdate setter
48+
dt_naiss=a;
49+
}
50+
51+
void setState(char st){
52+
// State setter
53+
situation=st;
54+
}
55+
56+
int getMatricule ()const{
57+
//Matrcule getter
58+
return matricule;
59+
}
60+
61+
string getNom ()const{
62+
// First name getter
63+
return nom;
64+
}
65+
66+
string getPrenom()const{
67+
//Last name getter
68+
return prenom;
69+
}
70+
71+
Date getDate()const{
72+
//Birthdate getter
73+
return dt_naiss;
74+
}
75+
76+
char getSituation()const{
77+
//Situation getter
78+
return situation;}
79+
80+
81+
82+
void saisie(){
83+
string nm,prnm;
84+
int mat;
85+
int ji,mi,ni;
86+
char situ;
87+
88+
cout<<"Saisir le nom et le prenom de l'employe"<<endl;
89+
cin>>nm>>prnm;
90+
setNom(nm,prnm);
91+
92+
cout<<"Saisir le matricule de l'employe"<<endl;
93+
cin>>mat;
94+
setMatricule(mat);
95+
96+
cout<<"Saisir la date de naissance de l'employe";
97+
cout<<"(jour/mois/annee)"<<endl;
98+
dt_naiss.set_jour(ji);
99+
dt_naiss.set_mois(mi);
100+
dt_naiss.set_annee(ni);
101+
102+
do{
103+
cout<<"Saisir la situation familiale de l'employe.";
104+
cout<<"(M pour Marie,C pour Celibataire et D pour Divorce)";
105+
cout<<endl;
106+
cin>>situ;
107+
setState(situ);
108+
}while(situ!='C' && situ!='M' && situ!='D');
109+
}
110+
111+
112+
113+
114+
// AFFICHE !
115+
116+
void Affiche(){
117+
cout<<"L'employe s'appelle "<<getNom()<<" "<<getPrenom()<<endl;
118+
cout<<"Son matricule est : "<<getMatricule()<<endl;
119+
cout<<"Il/Elle est ne(e) le : "<<getDate().j<<"/"<<getDate().m<<"/"<<getDate().a<<endl;
120+
switch(getSituation()){
121+
case 'M' :
122+
cout<<"L'employe(e) est Marie(e)"<<endl;
123+
break;
124+
case 'C' :
125+
cout<<"L'employe(e) est Celibataire"<<endl;
126+
break;
127+
case 'D' :
128+
cout<<"L'employe(e) est Divorce(e)"<<endl;
129+
break;
130+
}
131+
}
132+
133+
//MODIFIE !!
134+
135+
void Modifie(){
136+
char situ;
137+
cout<<"\t \t ------ Modification de la situation familiale de l'employe ------";
138+
cout<<endl;
139+
do{
140+
cout<<endl<<endl<<"Quel est la nouvelle situation familiale de l'employe ?"<<endl;
141+
cout<<"M pour Marie,C pour Celibataire et D pour Divorce)"<<endl;
142+
cin>>situ;
143+
setState(situ);
144+
}while(situ!='C' && situ!='M' && situ!='D');
145+
}
146+
};
147+
148+
int main(){
149+
Employe m;
150+
m.saisie();
151+
m.Affiche();
152+
m.Modifie();
153+
m.Affiche();
154+
return 0;
155+
}

0 commit comments

Comments
 (0)