Controlling iostream display behaviour.
-
I am trying to control how the scientific notation in VC++ display when I call it. It seems that iostream have a default behaviour how it should look like. I can't seems to be able to control it. For example, the scientific notation of the exponent have to be 3 digits long. There could only be 1.23E+003, where I wanted it to display 12.3E+002 , I can't seems to do that. Is there a library available that allows this to be implemented easily, or I have to write my own stream?I hope that is a easy way to do it. Any suggest from anyone? Just Danny
-
I am trying to control how the scientific notation in VC++ display when I call it. It seems that iostream have a default behaviour how it should look like. I can't seems to be able to control it. For example, the scientific notation of the exponent have to be 3 digits long. There could only be 1.23E+003, where I wanted it to display 12.3E+002 , I can't seems to do that. Is there a library available that allows this to be implemented easily, or I have to write my own stream?I hope that is a easy way to do it. Any suggest from anyone? Just Danny
-
Have you tried using the iostream format flags? Don't remember excatly but you could use the flags to format the output. Eg. cout<May the Source be with you Sonork ID 100.9997 sijinjoseph
Thanks for the reply. I can set it using setprecision() and setw(), but I can't change it's behaviour. I mean I like my scientific notation to have 2 digits before the decimal points not the default( ie. 1.23E+010) , I was hoping to get 12.34E+009 . Hope u can understand what I mean.I am converting a code from FORTRAN which allows this to happen. X|
-
Thanks for the reply. I can set it using setprecision() and setw(), but I can't change it's behaviour. I mean I like my scientific notation to have 2 digits before the decimal points not the default( ie. 1.23E+010) , I was hoping to get 12.34E+009 . Hope u can understand what I mean.I am converting a code from FORTRAN which allows this to happen. X|