Hello,
why there is illegal use of floating point?and what can be done to resolve it?
Code:
#include <iostream.h>
int main(void)
{
long double n=234234243234234,i=1221212121,k;
k=n%i
cout<<k ;
return 0;
}
Printable View
Hello,
why there is illegal use of floating point?and what can be done to resolve it?
Code:
#include <iostream.h>
int main(void)
{
long double n=234234243234234,i=1221212121,k;
k=n%i
cout<<k ;
return 0;
}
operator% is not defined for floating point types.Quote:
why there is illegal use of floating point?
Use fmod() from <cmath>Quote:
what can be done to resolve it?
Incidentally, <iostream.h> should be <iostream>, and I am guessing that 234234243234234 is too large to be an int literal, but should be made a double literal instead.
Ok thanks laser..!