QUOTE(Noldona @ 28 Aug, 2006 - 02:27 PM)

I do not understand why I am getting this error. I am using Visual Studios .NET 2005 MC++. The error I am getting is '%' : illeal, left operand has type 'float'. I have tried this with both a float and a double and it give me basically the same error. I don't understand this when the example the MSDN gives for this operator is "5.6 % 0.5 returns 0.1." Clearly floating-point numbers will work with this operator, just not for me however.
CODE
float temp, result;
temp = Convert::ToSingle(txtCP->Text);
result = temp % 1;
if (result != 0) {
temp -= result;
txtCP->Text = Convert::ToString(temp);
}
The result = temp % 1; line is the one I am getting the error one. Can anyone help me out with this one.
The modulus operator can only be applied to int, short, char, bool, long signed or unsigned.