#include "stdafx.h"
#include <stdio.h>

int A2i(char *p)
{
    int i = 0;
    int sum = 0;
    while (p[i])
    {
        sum = sum*10+(p[i]-'0');
        ++i;
    }

    return sum;
}


char *Itoa(
            int value,
            char *str,
            int radix 
            )
{
    char temp[20]={0};
    int i = 0;
    while(value)
    {
        temp[i] = value%radix + '0';
        value /= radix;
        ++i;
    }

    temp[i]=0;
    --i;

    int j = 0;
    while(i>=0)
    {
        str[j] = temp[i];
        ++j;
        --i;
    }

    return str;
}

int _tmain(int argc, _TCHAR* argv[])
{
    //char a[10]="258";
    //printf("%d\n",A2i(a));

    char a[20]={0};
    int sum = 26;
    printf("%s\n",Itoa(sum,a,10));
    
    getchar();
}