c++回文数判断
#include <bits/stdc++.h>
using namespace std;
bool huiwen(int x){
int y=x,num=0;
while(y!=0){
num=num*10+y%10;
y=y/10;
}
if(num==x) return 1;
else return 0;
}
int main()
{
int x;
cin>>x;
if(huiwen(x)){
cout<<"it is huiwen";
} else cout<<"bushi";
}
小白的第一篇文章,还请多多包涵~