Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class Complejo {
- public:
- double real;
- double imaginaria;
- Complejo() {
- this->real = 0;
- this->imaginaria = 0;
- }
- Complejo(double real, double imaginaria) {
- this->real = real;
- this->imaginaria = imaginaria;
- }
- Complejo(const Complejo& other) {
- this->real = other.real;
- this->imaginaria = other.imaginaria;
- }
- Complejo& operator =(const Complejo& other) {
- if (*this == other) return *this;
- this->real = other.real;
- this->imaginaria = other.imaginaria;
- return *this;
- }
- bool operator < (const Complejo& other) const {
- return (this->real < other.real);
- }
- bool operator > (const Complejo& other) const {
- return (this->real > other.real);
- }
- bool operator == (const Complejo& other) const {
- return (this->real == other.real) && (this->imaginaria == other.imaginaria);
- }
- operator int() const {
- return (int)this->real;
- }
- //Prefix
- Complejo& operator ++(void) {
- ++this->real;
- ++this->imaginaria;
- return *this;
- }
- //Posfix
- Complejo operator ++(int) {
- Complejo temp = *this;
- ++this->real;
- ++this->imaginaria;
- return temp;
- }
- // Shift
- Complejo operator <<(unsigned int shift) {
- Complejo temp = *this;
- // temp.real << shift;
- // temp.imaginaria << shift;
- return temp;
- }
- Complejo operator >>(unsigned int shift){
- Complejo temp = *this;
- // temp.real >> shift;
- // temp.imaginaria >> shift;
- return temp;
- }
- friend std::ostream& operator << (std::ostream& o, const Complejo& complejo);
- };
- std::ostream& operator << (std::ostream& o, const Complejo& complejo) {
- o << "(" << complejo.real << ", " << complejo.imaginaria << ")";
- return o;
- }
- int main() {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement