AceInfinity
Emeritus, Contributor
For the conversion of double to int, it's probably this part:
ceil returns a double I believe: ceil - C++ Reference
You need this:
Although ceil isn't really required here if you want an int. Just casting to an int will round for you:
Also, & is not what you think it is...
For these lines, replace & with &&. && is a logical operator, and & is a bitwise operator: Operators - C++ Documentation
Code:
int limit = ceil(sqrt(num));
ceil returns a double I believe: ceil - C++ Reference
You need this:
Code:
int limit = (int)ceil(sqrt(num));
Although ceil isn't really required here if you want an int. Just casting to an int will round for you:
Code:
int limit = (int)sqrt(num);
Also, & is not what you think it is...
Code:
if(num%i==0 & findIfPrime(num/i)){return num/i;}
if(num%i==0 & findIfPrime(i)){return i;}
For these lines, replace & with &&. && is a logical operator, and & is a bitwise operator: Operators - C++ Documentation