using namespace std;
int fanxushu(int number) {
int revx = 0;
while (number != 0) {
revx *= 10;
revx = revx + number % 10;
number = number / 10;
}
return revx;
}
int main() {
int n;
cin >> n;
if (abs(n)>=101&&abs(n)<=999) {
if (n > 0) {
if (n%100==0) {
return 0;
}
else if(n/100==0)
{
return 0;
}
else
{
int v = fanxushu(n);
cout << v;
}
}
else {
int L = 0;
L = -n;
if (L % 100 == 0) {
return 0;
}
else if (L / 100 == 0)
{
return 0;
}
else
{
int O = fanxushu(L);
cout << O;
}
}
}
}
不要引用自己的头文件 #include "pch.h"