so youre saying that the function must return true only if the number entered
matches any of the below(its a perfect square), or it's not a perfect square.
Thank you very much for the enligtenment i will try it out
square 1 = 1
square 2 = 4
square 3 = 9
square 4 = 16
square 5 = 25
square 6 = 36
square 7 = 49
square 8 = 64
square 9 = 81
square 10 = 100...
User Profile
Collapse
-
Code:bool IsSquare(int Num) { bool Flag = true; for (int I = 2; I < (sqrt(I) / 2); I++) if ((Num % I) == 0) { Flag = false; break; } return Flag; }
i have tried something of this sort, but the only problem is that
the square root function is a type double and what confuses me is how to find
out whether a number is a square root... -
C++ bool function
i am a nb on this portal and i require assistance with the foll:
I have to write a C++ boolean function, that determines whether an integer parameter is a square or not, and returns the answer to main( ).
could you plz assist me with that. I have tried using the square root function but it does not seem to work
--------------------------------------------------------------------------------
No activity results to display
Show More
Leave a comment: