0

I'm trying to display number on screen wihout using the exponential form (1x10e-7 etc) Unfortunatly as it converts the number to a string it converts the exponential format with it


Code:
double j; //as Long
string s; //as String

j=0.00000000001

ostringstream ss;
ss<<j;
s=ss.str();

cout<<s;


The programme will display 10e-10 instead of '0.00000000001' which I want

Edited by knotholaze: n/a

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by knotholaze
0

Try working with setprecision like below

#include<iostream>
#include <iomanip>


int main()
{
	double my_f = 1.0/3.0 / 30.0;
	std::cout << my_f << std::endl;
	std::cout << std::setprecision (100) << my_f << std::endl;


}
0

Actually i want to display the string variable in .00000000001 format not the double j.
Though i used fixed stream manipulator it convert double variable into .00000000001 but not the string variable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.