On the precision issue of converting “real-type data to strings

Hello!everyone,

I’d like to manually specify the precision to be retained when converting real-type data to string data. For example:
string s = 20.0e6;
cout << s << endl;
The output is 2e+07. I’d like to get an output of 2.00e+07 and keep scientific notation.

Are there any methods for doing this?

Thank you in advance.