From: "DeHackEd" References: <35A18DF3 DOT B7A4007D AT yahoo DOT com> Subject: Re: Help! Djgpp, Allegro, Floats and Ints!! Date: Tue, 7 Jul 1998 12:41:36 -0400 Lines: 39 Message-ID: Newsgroups: comp.os.msdos.djgpp NNTP-Posting-Host: d8-bn46-blvl-pda.attcanada.net [142.194.137.200] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Gareth Evans wrote in message <35A18DF3 DOT B7A4007D AT yahoo DOT com>... >I have a c plus plus program that has varibles that are floats. >(float x, y;) >It also has a bitmap (BITMAP *object;) >I need to use draw_trans_sprite(BITMAP *source, BITMAP *dest, int x, int >y) to draw BITMAP *object to the position defined in the varibles float >x, y. >The compiler refuses because I am not passing Draw_trans_sprite an >integer. What are the routines (if any) to convert between different >types of varibles. >If you have done basic, then an example is INT(.6738528) - this will >convert the number to 1. That works, but put INT in small case. Though typing int (.67) is generally acceptable C, most people tend to move the brackets around the int. x = (int) 0.67; Just be warned: Your example will round down. Test program: #include int main() { printf(" %d %d %d", (int) 1.1, (int) 0.9, (int) .67); } You would expect them to all round up to 1. Only the first one does. -- "DeHackEd" My Email address in the header is fake (spammers). Email me at this address: http://www.geocities.com/cgi-bin/homestead/mail.pl?dehacked