C#: Storing percentages, 50 or 0.50?

后端 未结 5 1018
情书的邮戳
情书的邮戳 2021-02-19 10:53

When holding percentage values in variables is there a preference between holding them as whole numbers vs fractions. That is should the variable hold numbers between 0 and 100

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 11:40

    I think this is trivial... both are the same

    I mean in terms of calculations/displaying info...

    00.50 is cool for calculations
    
    50.00 is cool for displaying
    

提交回复
热议问题