Rounding doubles - .5 - sprintf

前端 未结 5 812
遥遥无期
遥遥无期 2021-01-11 20:15

I\'m using the following code for rounding to 2dp:

sprintf(temp,\"%.2f\",coef[i]); //coef[i] returns a double

It successfully rounds 6.666

5条回答
提交回复
热议问题