|
From: Brian M. <str...@ho...> - 2001-10-31 02:20:00
|
I'm having much trouble trying to manipulate floats. I try to truncate the part left of the decimal like so: float num1 = 45.34; int num2 = int (num1); num1 -= float (num2); But when I display num1 (cout<<num1), I get something like 0.3400001. What am I supposed to do about this? Actually, the reason I am doing this is as part of a function that assigns a float to a string, i.e., storing num1 in something like strNum1 as "45.34" (apstring strNum1; strNum1 = num1). Any ideas on either of these two problems? _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp |