From: Charles Krug Newsgroups: comp.os.msdos.djgpp Subject: Re: [DESPERATE newbie]How to round a float to an int? Date: Wed, 27 Jan 1999 17:41:59 -0500 Organization: Pentek Corporation Lines: 31 Message-ID: <36AF9637.EAB66C9E@mail.pentek.com> References: <78nicq$ph6$1 AT zingo DOT tninet DOT se> NNTP-Posting-Host: mail.pentek.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mozilla 4.5 [en] (WinNT; U) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Benny börjesson" wrote: > Is there a function to round a float to an int(in c++)included in the DJGPP > package? > I searched and searched but I couldn't find one. HELP ME! Have you considered calling the constructor for int with your float as the argument? Like this? int main() { int i; float f; i = int(f); // calls the constructor for int with f as the argument } c people call this "type casting", and it has a slightly different syntax. Or doesn't that do what you need? -- Charles Krug, Jr. Application Engineer Pentek Corp 1 Park Way Upper Saddle River, NJ 07458