Skip to main content
gamedev.net
🔒 Locked

Float problem

Started by Zeke 1 reply 350+ views
Original Post
Zeke
Zeke
I have a float: 12.500000.How do I display this as just 12.50 ? Thanks for any help. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
acraig
acraig
Try

    
float number = 15.5000;
printf("%.2f", number);

// OR


cout.setf(ios::fixed);
cout.precision(2);
cout << number;




----------
Andrew

Edited by - acraig on November 10, 2000 11:35:06 AM
Zeke
Zeke
Thanks a lot acraig. That sorted it out quick.
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.