C: printf a float value

后端 未结 6 1351
-上瘾入骨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 09:04

    printf("%.f", myFloat) //where  - digit after comma
    

    http://www.cplusplus.com/reference/clibrary/cstdio/printf/

提交回复
热议问题