I’m trying to write 67.5 as 006750 with code below:
float price = 67.5
stringstream symbol;
symbol << setfill('0') << setw(6) << fixed << setprecision(2)
<< noshowpoint << price;
but output is 067.50
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are confused.
std::noshowpointonly eliminates the trailing.0on integer floats, for example60.0gets outputted as60, it doesn’t simply remove the point on all numbers.To get what you want you can do this: