```
class Solution {
public:
bool isHappy(int n) {
int sum = 0;
while(n > 0)
{
int x = n % 10;
sum += x*x;
n /= 10;
}
if(sum == 4)
{
return false;
}
else if(sum == 1)
{
return true;
}
else
{
return isHappy(sum);
}
}
};
···
···>
```