I have no idea why my program won't work right.....I still can't compare the fractions.

Still won't convert from int to float ..... values end up being 0....

I have attached most of my program code... and I'm tring to get the '<' comparison operator to work....

Code:

#include <iostream> // for cin and cout
#include <conio.h> // for getch
#include <math.h> // for the function to reduce fractions
#include <process.h> // for exit
using namespace std;
class Fraction // the Fraction class has two parts
{
private:
int denom;
int numer;
public:
Fraction() : denom(0), numer(1)
{ }
Fraction(int dm, int nm ) : denom(dm), numer(nm)
{}
friend istream& operator >>(istream& s, Fraction& d);
friend ostream& operator <<(ostream& s, Fraction& d);
Fraction operator + (Fraction two) const;
Fraction operator - (Fraction two) const;
Fraction operator * (Fraction two) const;
Fraction operator / (Fraction two) const;
bool operator < (Fraction two) const;
bool operator > (Fraction two) const;
bool operator == (Fraction two) const;
bool operator != (Fraction two) const;
void lowTerms();
operator float() const // conversion operator
{
float value = numer / denom;
return value;
}
};
//*****************Member Functions defined outside the class************
istream& operator >> (istream& s, Fraction& d)
{
char slash;
s >> d.numer;
s >> slash;
s >> d.denom;
return s;
}
ostream& operator << (ostream& s, Fraction& d)
{
s << d.numer << '/' << d.denom;
s << endl << endl;
return s;
}
Fraction Fraction::operator + (Fraction two)const
{
int n = numer * two.denom + denom * two.numer;
int d = denom * two.denom;
return Fraction(d,n);
}
//**********************************************************************
Fraction Fraction:: operator - (Fraction two) const
{
int n = numer * two.denom - denom * two.numer;
int d = denom * two.denom;
return Fraction (d,n);
}
//**********************************************************************
Fraction Fraction:: operator * (Fraction two) const
{
int n = numer * two.numer;
int d = denom * two.denom;
return Fraction (d,n);
}
//**********************************************************************
Fraction Fraction:: operator / (Fraction two) const
{
int n = numer * two.denom;
int d = denom * two.numer;
return Fraction (d,n);
}
//**********************************************************************
void Fraction::lowTerms() //function to reduce fractions
{ //to lowest terms - pg 262
int tnum, tden,temp, gcd;
tnum = abs(numer);
tden = abs (denom);
if(tden == 0)
{
cout <<"Illegal fraction : division by 0"; exit (1);
}
else if (tnum == 0)
{
numer = 0 ; denom = 1; return;
}
while (tnum !=0)
{
if (tnum < tden)
{
temp = tnum; tnum = tden; tden = temp;
}
tnum = tnum -tden;
}
gcd = tden;
numer = numer / gcd;
denom = denom / gcd;
}
//**********************************************************************
bool Fraction:: operator < (Fraction two) const
{
float first;
float second;
first = numer / denom;
second = two.numer / two.denom;
return (first < second) ? true : false;
}
//************************Main Function*****************************
void main()
{
Fraction fr1, fr2, fr3; //f1 and f2 are inputs, f3 is the result
float value;
char op;
char valid_operator= 'y';
char another_try='y';
cout << "\n-------- The four-function calculator ---------" << endl;
do
{
cout << "\nEnter a fraction, an operator (+, -, *, /), and another fraction: "
<< "\n (for example: 1/2 * 3/4) ";
cin >>fr1;
cin >> op;
cin >>fr2;
switch (op)
{
case '+':
fr3 = (fr1 + fr2); //overloading the + operator
break;
case '-':
fr3 = (fr1 - fr2); //overloading the - operator
break;
case '*':
fr3 = (fr1 * fr2);
break;
case '/':
fr3 = (fr1 / fr2);
break;
default:
valid_operator = 'n';
break;
}
if (valid_operator == 'y')
{
fr3.lowTerms();
// value = fr1;
//value = fr2;
cout << "\nThe result is "; cout << fr3;
if ( fr1 < fr2 )
{
cout << fr1;
cout << "is less than ";
cout << fr2;
cout << endl;
}
}
else
{
cout << "The operator must be +, -, *, or /. Try again! " << endl;
valid_operator = 'y';
}
cout << "\tDo another calculation? ";
cin >> another_try;
} while (another_try == 'y');
getch();
}

HELP PLZ..............thanks