Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Complexe.h"
- Complexe::Complexe(float i, float r): _imaginaire(i), _reel(r) {}
- // Complexe::Complexe() : imaginaire(0), reel(0){};
- void Complexe::editer() const {
- cout << "Imaginaire :" << _imaginaire << endl;
- cout << "Reel :" << _reel << endl;
- }
- bool Complexe::operator>(Complexe complx) const{
- float carrePartieReel1 = _reel * _reel;
- float carrePartieReel2 = complx._reel * complx._reel;
- float carrePartieImaginaire1 = _imaginaire * _imaginaire;
- float carrePartieImaginaire2 = complx._imaginaire * complx._imaginaire;
- float sommeFirst = carrePartieImaginaire1 + carrePartieReel1;
- float sommeSecond = carrePartieImaginaire2 + carrePartieReel2;
- return ( sommeFirst > sommeSecond ? true : false );
- }
- void Complexe::set_Reel(float r) {
- _reel = r;
- }
- void Complexe::set_Imaginaire(float i){
- _imaginaire = i;
- }
- float Complexe::get_Reel() const {
- return _reel;
- }
- float Complexe::get_Imaginaire() const{
- return _imaginaire;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement