folks! I've been struggling with this problem for some time and so far I haven't found any solution to it.
In the code below I initialize a string with a number. Then I use std::istringstream to load the test string content into a double. Then I cout both variables.
#include <string>
#include <sstream>
#include <iostream>
std::istringstream instr;
void main()
{
using std::cout;
using std::endl;
using std::string;
string test = "888.4834966";
instr.str(test);
double number;
instr >> number;
cout << "String test:\t" << test << endl;
cout << "Double number:\t" << number << endl << endl;
system("pause");
}
When I run .exe it looks like this:
String test: 888.4834966
Double number 888.483
Press any key to continue . . .
The string has more digits and it looks like std::istringstream loaded only 6 of 10. How can I load all the string into the double variable?