I'm working on representing fractions as well, but it seems that doing it with classes is easier, then you can overload the input (std::cin) function, and it works quite smoothly...

But when you want to learn structures:

Code:

struct fraction
{
int num; // numerator
int denom; // denominator
};

Basically, this declears the struct fraction to contain these two integers.

Then make some function to compare/add/multiply/divide two structures, something like this:

Code:

bool compareFractions( fraction& firstFraction, fraction& secondFraction )
{
if( firstFraction.denom == secondFraction.denom )
if( firstFraction.num == secondFraction.num)
return true;
// They are totally equal!
else
return false;
else
// Multiply up to the common denominator
// Then compare the numerator
}

As you can see, compareFractions takes two fraction references and compares them.

As far as input is concerned, I have no idea of a good solution to that, other than creating classes, as I mentioned.

Hope some o' this helped

-- Placid