-
Fractions
Hi,
I am having a problem with fractions in my class. The problem is to create a member function to add two fractions and create a member function to subtract two fractions, so far I get..
class fraction{
private:
int Whole;
int Numerator;
int Denominator;
};
int fraction::AddFraction( int x, int y)
{
}
int fraction::SubstractFraction(int x, int y)
{
}
but I cant seem to do the math for the fractions. Can someone help. Thanks
-
1) Must have same denominator (if not =, multiplying denominators will give a common denominator)
2) After added/subtracted, you can reduce
3) Can you use improper fracts, it will be easier?
-
Thanks, that helps alot
-nika