delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/06/09:35:42

From: "POULAIN Vincent" <vpoulain AT club-internet DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how to convert float ->int?
Date: 31 May 1997 01:01:37 GMT
Organization: Grolier Interactive Europe
Lines: 19
Message-ID: <01bc6d5d$4afb4aa0$LocalHost@vpoulain>
References: <01bc6dff$6cbac9c0$10ee13cb AT bbs>
NNTP-Posting-Host: ppp-102-132.villette.club-internet.fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


abcEd <abced AT pinnacle DOT com DOT au> a écrit dans l'article
<01bc6dff$6cbac9c0$10ee13cb AT bbs>...
> whats the best way of converting from float to int?

I do use a simple way :

int a;
float b=3.14;

a=b;

Fine, isn't it ?
Only if you want the integer part of your float.
If you want a rounded value, this will not work of course :-)

Vincent

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019