🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6309

Re: format question

#6309
From: JD
Date: Tue, 24 May 2005 22:24
13 lines
1293 bytes
"Karim" <karim@noemail.com> wrote:
>
> What about if I want to change the number after the point in
> two numbers? 12.3 becomes 000012.30

Break the float into 2 ints:

    int WholePortion = SomeFloat;
    int DecimalPortion = (SomeFloat - WholePortion) * 100;
    Buffer.sprintf("%06d.%d", WholePortion, DecimalPortion );

~ JD
Technical Details
Message-ID: <4293a9ba$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4292f5a8$1@newsgroups.borland.com> <42931256$1@newsgroups.borland.com> <42933ba8$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3b7f7b4a56d80b10
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: format question
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 205.188.116.139     
X-Forwarded-For: 172.153.81.116
References:  <4292f5a8$1@newsgroups.borland.com> <42931256$1@newsgroups.borland.com> <42933ba8$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4293a9ba$1@newsgroups.borland.com>
Date: 24 May 2005 15:24:58 -0700
X-Trace: newsgroups.borland.com 1116973498 207.105.83.66 (24 May 2005 15:24:58 -0700)
Lines: 14
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail