#include "Fraction.h" using ecci::Fraction; // Funcion libre int main() { Fraction fr1; fr1.setDenominator(-3); fr1.setDenominator(0); std::cout << "fr1 = "; fr1.print(); std::cout << std::endl; Fraction fr2(18, -30); std::cout << "fr2 = "; fr2.print(); std::cout << std::endl; Fraction fr3(5); std::cout << "fr3 = "; fr3.print(); std::cout << std::endl; Fraction* fr0 = new Fraction(); std::cout << "fr0 = "; fr0->print(); std::cout << std::endl; delete fr0; //Fraction sum1 = fr2.add(fr3); // Java // Fraction sum1 = fr2 + fr3; // C++ // Fraction sum1 = fr2.operator+(fr3); // C++ Fraction sum1 = operator+(fr2, fr3); // C++ std::cout << "sum1 = fr2 + fr3 = "; sum1.print(); std::cout << std::endl; Fraction sum2 = operator+(fr2, 7); // C++ // Fraction sum2 = fr2.operator+(7); // C++ // Fraction sum2 = fr2.operator+( Fraction(7) ); // C++ std::cout << "sum2 = fr2 + 7 = "; sum2.print(); std::cout << std::endl; Fraction sum3 = fr2 + fr3 + 7 + sum1; // Fraction sum3 = fr2.add(fr3).add(Fraction(7)).add(sum1); std::cout << "sum3 = fr2 + fr3 + 7 + sum1 = "; sum3.print(); std::cout << std::endl; Fraction fr4; std::cin >> fr4; std::cout << "fr4 = " << fr4 << std::endl; std::cout << "fr4 + fr3 + 1 == " << fr4 + fr3 + 1 << std::endl; }