float keeping 0 as a last digit (e.g 0.50 instead of 0.5)

is there something I can do to make this happen? I'm tried looking at setting precision but it doesn't seem to work, and I'm not sure what I'm supposed to be looking for.

never mind, I found what I was looking for

1
2
std::cout.precision(2);
std::cout << std::fixed << price << std::endl;
Last edited on
std::cout << std::fixed << std::setprecision(2) << 0.5 << '\n';
thanks anyway, but you were 2 minutes too late :3
Topic archived. No new replies allowed.