There should not be a problem with changing the function's arguments to floats. You can call a function that takes an float argument with an int instead and the int will just be converted to a float. No harm done. I notice I'm contradicting myself because if what I just said was true, then you should have no problem calling sqrt with an int, but I think it doesn't let you do this with sqrt because it's an overloaded function and so your compiler doesn't know which type to convert to. But anyway, you can do this,
- int square_check (float x, float y )
-
{
-
// Function Body Snipped.
-
}
or if you have a good reason to make the function's arguments ints, you can cast x+y to a float like this.
- int square_check (int x, int y )
-
{
-
float z= sqrt((float)(x+y));
-
-
if (z ==(int)z)
-
return 1;
-
else
-
return 0;
-
-
}
Hope this helps, and when you are posting code, please put
[CODE] before it and
[/CODE] after it, to make it show up in a code box.