How to print fraction in floating-point format?

0

How can I print fraction in floating format in C ++? I researched how this format would look, but I did not find anything. E.g:

5

__

3

    
asked by anonymous 21.04.2018 / 19:14

1 answer

0

Solution

std::cout.unsetf(std::ios::floatfield);

std::cout.precision(2);

std::cout << "\n3[36mFração3[37m : " << static_cast< float >(this->numerador) << " 3[31m-3[37m " << static_cast< float >(this->denominador) << "\n";
    
21.04.2018 / 20:36