timber
June 4th, 1999, 10:28 PM
Hi,
I'm trying to duplicate a routine I have in VB to VC++. It's a loop that checks to see if a floating point number becomes a whole number.
In VB I used a while loop that checked for the decimal point using the InStr function. In the body of the loop I would alternate the VAL and STR functions to change the number from a string to a real number. With a multiplication routine inside the loop, eventually the floating point number would reach a whole number without any fractional amount left over,the STR conversion of the whole number would drop the decimal off of the string and would terminate the loop.
All the conversion routines in C++ seem to pad zeros to the right of the decimal point of a floating point number if it becomes a whole.
Does anyone know of a way to reproduce the effect I had in VB so I can drop out of a loop if a number has no fractional amount left over?
Steve Palmer
I'm trying to duplicate a routine I have in VB to VC++. It's a loop that checks to see if a floating point number becomes a whole number.
In VB I used a while loop that checked for the decimal point using the InStr function. In the body of the loop I would alternate the VAL and STR functions to change the number from a string to a real number. With a multiplication routine inside the loop, eventually the floating point number would reach a whole number without any fractional amount left over,the STR conversion of the whole number would drop the decimal off of the string and would terminate the loop.
All the conversion routines in C++ seem to pad zeros to the right of the decimal point of a floating point number if it becomes a whole.
Does anyone know of a way to reproduce the effect I had in VB so I can drop out of a loop if a number has no fractional amount left over?
Steve Palmer