I thought this would be simple, but searching Google didn’t seem to help.
I’m basically trying to write a function which will return a ratio as a string (eg 4:3) when supplies with two integers (eg 800 and 600).
string GetRatio(Int A, Int B) { // Code I'm looking for return Ratio; }
You can simplify fractions by dividing numerator and denominator by their GCD:
And a very basic function for calculating the GCD, using the Euclidean algorithm: