C: printf a float value

后端 未结 6 1347
-上瘾入骨i
-上瘾入骨i 2020-11-28 08:36

I want to print a float value which has 2 integer digits and 6 decimal digits after the comma. If I just use printf(\"%f\", myFloat) I\'m getting a truncated va

6条回答
  •  孤独总比滥情好
    2020-11-28 08:55

    printf("%9.6f", myFloat) specifies a format with 9 total characters: 2 digits before the dot, the dot itself, and six digits after the dot.

提交回复
热议问题