+ 1

how to display millions

I can't display millions. For example car price = 1,470,000 insurance = 20580 roadtax= 12048 totalprice = 1.50263e+006 why the total price will be like that ? I used ' double ' for data type

8th Dec 2018, 4:33 PM
Syed Bob
2 Antworten
+ 9
Either use int or any other data type Or you can simply use std::fixed Here's the code double carprice = 1470000; double insurance = 20580; double roadtax= 12048; double totalprice = carprice+insurance+roadtax; cout<<fixed<<totalprice; This should give you the total price with proper decimals
8th Dec 2018, 4:46 PM
Frost
Frost - avatar
+ 1
Thank you so much sir, you're really helpful. Have a nice day sir !
9th Dec 2018, 6:36 AM
Syed Bob