I need help rounding off a float value to one decimal place.
I know setprecision(x)
and cout << precision(x)
. Both of which work if I wanted to round the entire float, but I am only interested in rounding the decimals to the tenths place.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…