In C++, When I calculate 2/3, it will output decimal values, how can I just get the original format (i.e.g 2/3) instead of 0.66666667
Thanks
To simplify efforts, I suggest you stick with known denominators if possible.
I'm working with an application where the fractions are restricted to denominators of powers of 2 or using 3 (for thirds).
I convert to these fractions using an approximation (rounding to the nearest 1.0/24.0).
Without some restrictions, finding the denominator can be quite a chore and take up a lot of the execution time.