```// A C++ recursive program to print all N-digit numbers with
// absolute difference between sum of even and odd digits is 1
#include <bits/stdc++.h>
using namespace std;

// Recursive function to print all N-digit numbers with absolute
// difference between sum of even and odd digits is 1.
// This function considers leading zero as a digit

// n --> value of input
// out --> output array
// index --> index of next digit to be filled in output array
// diff --> difference between sum of even and odd digits so far
void findNDigitNumsUtil(int n, char* out, int index, int diff)
{
// Base case
if(index > n)
return;

// If number becomes N-digit
if(index == n)
{
// if absolute difference between sum of even and
// odd digits is 1, print the number
if(abs(diff) == 1)
{
out[index] = '\0';
cout << out << " ";
}
return;
}

// If current index is odd, then add it to odd sum and recurse
if(index & 1)
for(int i = 0; i <= 9; i++)
{
out[index] = i + '0';
findNDigitNumsUtil(n, out, index + 1, diff - i);
}
else // else add to even sum and recurse
for(int i = 0; i <= 9; i++)
{
out[index] = i + '0';
findNDigitNumsUtil(n, out, index + 1, diff + i);
}
}

// This is mainly a wrapper over findNDigitNumsUtil.
// It explicitly handles leading digit and calls
// findNDigitNumsUtil() for remaining indexes.
int findNDigitNums(int n)
{
// output array to store N-digit numbers
char out[n + 1];

// Initialize number index considered so far
int index = 0;

// stoores diff between even and odd sums
int diff = 0;

// Explicitly handle first digit and call recursive function
// findNDigitNumsUtil for remaining indexes. Note that the
// first digit is considered to be present in even position.
for(int i = 1; i <= 9; i++)
{
out[index] = i + '0';
findNDigitNumsUtil(n, out, index + 1, diff + i);
}
}

// Driver program
int main()
{
int n = 3;

findNDigitNums(n);

return 0;
}
```

### Output:

`100 111 120 122 131 133 142 144 153 155 164 166 175 177 186 188 197 199 210 221 230 232 241 243 252 254 263 265 274 276 285 287 296 298 320 331 340 342 351 353 362 364 373 375 384 386 395 397 430 441 450 452 461 463 472 474 483 485 494 496 540 551 560 562 571 573 582 584 593 595 650 661 670 672 681 683 692 694 760 771 780 782 791 793 870 881 890 892 980 991 `