#include <iostream>
#include "racional.h"

using namespace std;

Racional Racional::operator+(Racional a) {
  this->num = this->num*a.den+this->den*a.num;
  this->den = this->den*a.den;
  return *this;
}

Racional Racional::operator-(Racional a) {
  this->num = this->num*a.den-this->den*a.num;
  this->den = this->den*a.den;
  return *this;
}

Racional Racional::operator*(Racional a) {
  this->num = this->num*a.num;
  this->den = this->den*a.den;
  return *this;
}

Racional Racional::operator/(Racional a) {
  this->num = this->num*a.den;
  this->den = this->den*a.num;
  return *this;
}

void Racional::escribe(){
  cout << num << "/" << den << "\n";
}

