- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
#include <iostream>
#define GAY(x) #x
#define STR(x) GAY(x)
#define A0(x, i) (i)*10 + (*(x)-'0')
#define A1(x, i) (*(x + 1) ? A0(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A2(x, i) (*(x + 1) ? A1(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A3(x, i) (*(x + 1) ? A2(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A4(x, i) (*(x + 1) ? A3(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A5(x, i) (*(x + 1) ? A4(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A6(x, i) (*(x + 1) ? A5(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A7(x, i) (*(x + 1) ? A6(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A8(x, i) (*(x + 1) ? A7(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A9(x, i) (*(x + 1) ? A8(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A10(x, i) (*(x + 1) ? A9(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A11(x, i) (*(x + 1) ? A10(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A12(x, i) (*(x + 1) ? A11(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A13(x, i) (*(x + 1) ? A12(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A14(x, i) (*(x + 1) ? A13(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define A15(x, i) (*(x + 1) ? A14(x + 1, (i) * 10 + *(x)-'0') : (i) * 10 + *(x)-'0')
#define STOI(x) A15(STR(x), 0)
int main(int argc, char *argv[])
{
std::cout << STOI(01) << std::endl <<
STOI(08) << std::endl <<
STOI(0123) << std::endl <<
STOI(0123456789) << std::endl;
return 0;
}
Теперь можно добавлять нолики в начало чисел для выравнивания!