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:
Basically, this declears the struct fraction to contain these two integers.
int num; // numerator
int denom; // denominator
Then make some function to compare/add/multiply/divide two structures, something like this:
As you can see, compareFractions takes two fraction references and compares them.
bool compareFractions( fraction& firstFraction, fraction& secondFraction )
if( firstFraction.denom == secondFraction.denom )
if( firstFraction.num == secondFraction.num)
// They are totally equal!
// Multiply up to the common denominator
// Then compare the numerator
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