operator overloading

 
 
Make a class fraction () with a numerator and a denominator.
Create a constructor and overload some operators so that the code below can run on 

int main(){
Fraction f1(1,2);
Fraction f2(2,9);
Fraction f3(2,4);
if(f1 < f2){
cout << f1 << " is smallest " <<endl
}
else if(f1 == f2){
cout << "They are equal" << endl;
}
else{
cout << f2 << "Is smallest";
}
if(f1 == f3){
cout << "I did it" << endl;
}
if(f1 < 4){
f1 = f1 + f2;
cout << f1 << endl;
}
f2 = f2 + 5;
cout << f2 << endl;
}

Started by Aaron at February 11, 2019 - 12:33 PM