#include <iostream>
using namespace std;
int main()
{
    string str="-1.2300";
    double d = stod(str);
    cout<<d<<"\n";
}
output: -1.23
i am expecting output as following
-1.2300
#include <iostream>
using namespace std;
int main()
{
    string str="-1.2300";
    double d = stod(str);
    cout<<d<<"\n";
}
output: -1.23
i am expecting output as following
-1.2300
 
    
     
    
    If that is what you want, then you need to use formatted output with a precision specifier:
printf("%.4f\n", d);
or specify the precision for cout:
cout.precision(4);
cout << fixed << d << "\n";
