给你写个函数吧
void work(int n){ int num = 0; while(n) { cout << n % 10; n /= 10; num++; } cout << endl; cout << num <}