整数转换成字符串itoa函数;字符串转换成整数atoi函数
参考:http://c.chinaitlab.com/c/basic/200902/776622.html
 
//atoi的实现
#include<iostream>
using namespace std;
int atio1(char *s)
{
int sign=1,num=0;
    if(*s=='-')
        sign=-1;
    s++;
    while((*s)!='\0')
    {
        num=num*10+(*s-'0');
        s++;
    }   
    return num*sign;   
}
 
 
//itoa的实现
char *itoa(int num, char *str, int radix)
{
    char* ptr = str;
    int i;
    int j;

    while (num)
    {
        *ptr++  = string[num % radix];
        num    /= radix;

        if (num < radix)
        {
            *ptr++  = string[num];
            *ptr    = '\0';
            break;
        }
    }

    j = ptr - str - 1;

    for (i = 0; i < (ptr - str) / 2; i++)
    {
        int temp = str[i];
        str[i]  = str[j];
        str[j--] = temp;
    }

    return str;
}
 
 
 
int main()
{
    char *s="-123567890";   
    cout<<atio1(s);
    system("pause");
}