0
Printing fractions in C++
I was wondering how I could print a fraction in C++ on SoloLearn without the compiler doing the math before printing it. When I write in fraction format (lets say 1/2 and 3/8), the compiler does the math and prints the quotient (0.5 and 0.375, respectively). I want to be able to print the fraction, not the quotient of the division problem. Is there any way I could do that on SoloLearn?
1 Respuesta
+ 1
The only way to do it (that I know of) is to print it out as a string.