众所周知C++有许多好用又方便的库函数。

to_string()可以把数字转成对应的字符串;

reverse()函数可以实现字符串的快速翻转;

stringstream 可以方便操作字符串并将其转成数字;

然后……然后就没了(i的九倍也是四位数,i不能超过1111,可以缩短一点循环)

#include <iostream>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    for ( int i = 1000; i <= 1111; i ++ ){
        string s = to_string(i);
        reverse(s.begin(),s.end());
        stringstream geek(s);
        int x;
        geek >> x;
        if ( i*9 == x ) cout << i << endl;
    }
    return 0;
}