The math part is not correct. Can't figure out how to fix so that
when you put in a decimal number, it gives you the LCD fraction.
Here's the code:
CRational::CRational (int getnumerator, int getdenominator )
{
m_numerator = getnumerator;
m_denominator = getdenominator;
setProperForm();
}
CRational::CRational (double value) // conversion constructor
{
double x = 1/value;
// find nearest full number
double n = 1;
double d = x;
while(((int)(d * 10.0) % 10)!= 0)
{
n = n + 1;
d = x * n;
}
m_numerator = (int)n;
m_denominator = (int)d;
setProperForm();
}