- 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;
}
Теперь можно добавлять нолики в начало чисел для выравнивания!
gost 27.10.2016 15:50 # 0
kurwa-nextgen 27.10.2016 15:51 # 0
gost 27.10.2016 16:06 # 0
guest 28.10.2016 17:31 # 0
guest 28.10.2016 17:37 # 0
gost 28.10.2016 17:38 # 0
guest 28.10.2016 17:40 # 0
guest 01.11.2016 13:50 # 0
inkanus-gray 01.11.2016 16:36 # +3
Хорошо, что gost смог сгладить это недоразумение.
Soul_re@ver 01.11.2016 16:45 # +1
inkanus-gray 01.11.2016 16:49 # +1
dxd 01.11.2016 16:51 # +2
Soul_re@ver 01.11.2016 16:53 # +4
barop 01.11.2016 16:55 # −61
gost 01.11.2016 18:04 # +2
j123123 17.11.2021 06:36 # 0