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

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;


}

Use the "fixed" stream manipulator.

#include <iostream>
using namespace std;

int main() {
  const double PI = 3.14159265;

  cout << fixed << "The value of PI is: " << PI << endl;

  return 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.