Convert E+ format to float, without carrying out E+ multiplication | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Convert E+ format to float, without carrying out E+ multiplication

If a method returns a float in the E+ format, is there a way to display it in float format without carrying out the E+ multiplication. I understand the E+ = times ten to the power of(i hope) :P But sometimes the method returns a number smaller than one million, in that case i do not want to apply E+.

19th Dec 2016, 4:26 PM
Rory Scanlan
Rory Scanlan - avatar
1 Réponse
+ 1
Hi, you can manipulate the format of the output stream cout, e.g. try cout.setf(ios::fixed, ios::floatfield); You can also set the number of digits by using cout.precision(numDigits) and so on. For further options, have a look at those two functions in the C++ reference. Regards, Alex
20th Dec 2016, 12:44 PM
alex189