'Assignment with float [duplicate]

I knew with command <<fixed << set precision() for command cout <<. But now I want to assign it, for example I have a float = 1.23456 and I want to have float b= 1.23. Can I use assign b by a with command fixed and set precision() ?. Thank you^^



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source