回文数 2018-07-12
2018-07-12 本文已影响0人
嘿咚
题目
<pre>
bool isPalindrome(int x) {
stringstream stringstream_x;
stringstream_x<< x;
string string_x = stringstream_x.str();
string string1(string_x);
reverse(string_x.begin(),string_x.end());
if (string1.compare(string_x) ==0){
return true;
}else{
return false;
}
// int x_reverse;
// stringstream stream(string_x);
// stream>> x_reverse;
}
</pre>