用递归函数将int类型转换为string类型

请问各位在c++如何运用递归函数将int类型转化成string类型 不用库里面inttostring转换的函数

将整数不断除以10,如果结果不为0,则继续调用递归,最后将余数加上'0'变成字符后加入字符串

#include <iostream>
#include <string>
using namespace std;
void fun(int n,string &s)
{
    if(n/10>0)
        fun(n/10,s);
    s += n%10+'0';
}

int main()
{
    int n;
    string s;
    cin>>n;
    fun(n,s);
    cout<<s<<endl;
    return 0;
}