看了一下这个文章http://www.codeceo.com/article/alibaba-interview-java.html
顺手写了下 应该符合题目意思吧~~
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
string intTostring(int n)
{
string tem;
if(n /10 == 0)
{
tem = tem + char((n + '0'));
}
else
{
tem = tem + char((n%10 + '0')) + intTostring(n/10);
}
return tem;
}
int main()
{
int n;
while(cin>>n)
{
string t = intTostring(n);
cout<<t<<endl;
}
return 0;
}