26 `Rational::Rational()' and `Rational::Rational()' cannot be overloaded 97 `void Rational::setDenom(int)' and `void Rational::setDenom(int)' cannot be overloaded In member function `Rational Rational::add(Rational)': 47 no match for 'operator/' in '((Rational*)this)->Rational::num / ((Rational*)this)->Rational::gcd(((Rational*)this)->Rational::num, ((Rational*)this)->Rational::denom)'

to name a few. There is no program yet, just creating the class and class member functions

#include <iostream> // input and output #include <stdlib.h> // pause screen after completion #include <math.h> #include <iomanip> using namespace std; class Rational{ private: int num; int denom; public: Rational(); Rational(int n, int d); Rational add(Rational c); Rational multiply(Rational c); void setDenom(int d); Rational() { num = 1; denom = 1; } Rational(int n, int d) { num = n; if(d != 0) denom = d; else cout << "erorr: Denominator cannot be 0"; } Rational add(Rational x) { Rational temp(num, denom); // create an object with 1/3 temp.num = temp.num + x.num; // add 2/3 object to the 1/3 = 3/3 return Rational (num/gcd(num,denom),denom/gcd(num,denom)); //return temp; // return 3/3 } Rational subtract(Rational x) { Rational temp(num, denom); // create an object with 1/3 temp.num = temp.num - x.num; // subtract 2/3 object to the 1/3 = 1/3 return Rational (num/gcd(num,denom),denom/gcd(num,denom)); // return temp; // return 1/3 } Rational multiply(Rational x) { Rational temp(num, denom); temp.num = temp.num * x.num; temp.denom = temp.denom * x.denom; return Rational (num/gcd(num,denom),denom/gcd(num,denom)); //return temp; } Rational divide(Rational x) { Rational temp(num, denom); temp.num = temp.denom; // make reciprocal temp.denom = temp.num; temp.num = temp.num * x.num; // multiply by the reciprocal temp.denom = temp.denom * x.denom; return Rational (num/gcd(num,denom),denom/gcd(num,denom)); //return temp; } /* Rational reduce(Rational x) { Rational temp(num, denom); r = [(temp.num) && (temp.denom) / gcd(temp.num,temp.denom)]; return temp; } */ void setDenom(int d) { if(d != 0) denom = d; } Rational gcd (int num, int denom){ while( denom != 0) { //gcd = temp.num % temp.denom; gcd = num % denom; num = denom; denom = gcd; return gcd; } }