#include <iostream.h>
class date{
int jj;
int mm;
public:
date(int jour=0, int mois=0); // pas oublier d'initialiser sinon ca pose probleme
friend date operator-(date d1, date d2);
friend date operator+(date d1,date d2);
void lire();
void affiche();
};
date::date(int jour, int mois){
jj=jour;
mm=mois;
}
date operator+(date d1, date d2){
date result;
result.jj=d1.jj+d2.jj;
result.mm=d1.mm+d2.mm;
return result;
}
date operator-(date d1, date d2){
date result;
result.jj=d1.jj-d2.jj;
result.mm=d1.mm-d2.mm;
return result;
}
void date::lire(){
cout<<"Entrer le jour : "<<endl;
cin>>jj;
cout<<"Entrer la date : "<<endl;
cin>>mm;
}
void date::affiche(){
cout<<" le resultat de l'operation sur les dates "<<endl;
cout<<jj<<" / "<<mm<<endl;
}
void main(){
date a;
date b;
date c;
a.lire();
b.lire();
c=a+b;
c.affiche();
c=a-b;
c.affiche();
}