2021年3月3日星期三

C++ decimal placement

how would I make it so when i enter 2.785 for the input question the output will display the variable question as 2.79?

I tried using setprecision but for some reason it is not working unless i am doing it wrong

here is the user input question and what it should be:

Enter positive daily growth % (.1 must be entered as 10):  user enters "2.785"  output -> 0.02785  

My desired output should look like:

desired output-> 2.79%  

Any help is appreciated. I know it may seem simple to others but I have already tried looking online and everything I find just isn't making sense or doesn't work and I dont know what I am doing wrong.

https://stackoverflow.com/questions/66468237/c-decimal-placement March 04, 2021 at 11:41AM

没有评论:

发表评论