I believe what you want is something like this:
cout << std::setprecision(1) << a+b;
solved Loss of precision on adding doubles [duplicate]
I believe what you want is something like this:
cout << std::setprecision(1) << a+b;
solved Loss of precision on adding doubles [duplicate]