TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: FRANK MASINGILL
from: ANTON S. MAXIMENKO
date: 1997-04-02 12:01:00
subject: Formatting floats

    Best wishes,  Frank !
  Years ago, in dark medieval times,
        Frank Masingill have written to Sarah Nunez:
 FM>     I know you are much further along than I am in learning C++ but
 FM> thought I'd share something that with all of the aftermarket books and
 FM> tutorials I have was not easy to find.
    Thing you are looking for is very simple.... :)
 FM>     In order to get a correct format of a float I found that I had to
 FM> use
 FM> something called "setprecision" which I think is prototyped in 
omanip.h.
 FM> I don't know if there are any other ways of doing it or not.  Most of 
he
 FM> example programs simply let it go at formatting a dollar amount to
 FM> something like $25.00003 or something like that which was horrible.
    Goog, watch here. You must put to your stream special functions called 
"manipulators", which stored in "iomanip.h", of course. I don't know about 
other compiles, becouse I use Borland 3.1 (best for education and suxx for 
serious work).
    There is examples with comments:
  cout< * Origin: Night is so beautiful (we need her as we need Day) (2:5020/535.29)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.