How to make a long float or something

Ok so in my game the player is given a billion dollars to start with, i have

float money = 1000000000;

but when i go to display the money it gives me a weird number: 1e+009

I think its illegal to do a long or unsigned float, i could do an int but i need precise point numbers so what do i do?

I tried unsigned long int and that worked but is there any way to do it with a float?
Last edited on
"long float" is called double, which is what you should use when you need to deal with floating point numbers, unless you have very good reasons to use float.
However, your issue is unrelated to that, it's just the way you print it:
1
2
#include <iomanip>
cout << fixed << setprecision(2) << money << endl;


http://www.cplusplus.com/reference/iostream/manipulators/fixed/
1e+009 is 1 * 10^9, which is 1 billion.
Topic archived. No new replies allowed.