🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Another delphi translation please!

#5146
From: Andrue Cope [TeamB]
Date: Mon, 26 Sep 2005 13:09
22 lines
1431 bytes
Bruce Knowles wrote:

> x mod y      ->   x % y
> x div  y       ->   (int) (x / y)

I don't understand what you're saying there.

if 'x' and 'y' are both 'ints' then the expression 'x/y' is implicitly
an 'int' and the decimal part is lost (exactly what Delphi's 'div'
does)  There's no need to cast it.

Even if you're assigning it to a float..

  int x=1, y=2;
  float a=x/y;

..'a' will be zero not 0.5

-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <4337f2a2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <43370a81@newsgroups.borland.com> <4337b0dd$1@newsgroups.borland.com> <4337e343@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6ea8b2c4d2578842
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address>
Subject: Re: Another delphi translation please!
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43370a81@newsgroups.borland.com> <4337b0dd$1@newsgroups.borland.com> <4337e343@newsgroups.borland.com>
Date: Mon, 26 Sep 2005 14:09:35 +0100
User-Agent: XanaNews/1.17.6.4
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <4337f2a2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1127740066 217.207.223.34 (26 Sep 2005 06:07:46 -0700)
Lines: 22
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail