User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 397,648 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,392 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:

Double values with two decimal places

Join Date: Jun 2004
Location: Marin, CA, USA
Posts: 434
Reputation: Chainsaw is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 9
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Double values with two decimal places

  #2  
Feb 3rd, 2005
If it were me, I'd use sprintf() or one of its variants (_snprintf, say).

char display[30];
_snprintf( display, sizeof(display), "%.2f", empMoney );

And forget about scaleing it manually.
Reply With Quote  
All times are GMT -4. The time now is 11:19 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC