C++ solution compare double and its floor(or ground) number. float is ok in this problem.

```
class Solution {
public:
bool isPowerOfThree(int n) {
if(n <= 0) return false;
double x = log10(n)/log10(3);
return x == floor(x);
}
};
```