The last decimal value is not converted to double and does not appear in the print. How to fix this?
#include <iostream>
using namespace std;
double toDouble(const char* str)
{
return stod(str);
}
int main()
{
string text = "10158.34";
double value = toDouble(text.c_str());
cout << value << endl;
return 0;
}
Thanks.