Mapped Strings-cant find error with the code

i am having problem in solving problems with recursion,
i know, right now i am printing it backwards…

here is my code
#include
#include
using namespace std;

void MappedString(int n,int j,char ans[],char list[]){

if(n==0){	

	cout<<ans<<endl	;
	
	return;
}

int t1=n%10;
ans[j]=list[t1-1];
MappedString(n/10,j+1,ans,list);


int t2=n%100;
if(t2>26 || t2<=9){
	return;
}
else{
	ans[j]=list[t2-1];
	MappedString(n/100,j+1,ans,list);
}

}

int main() {
int n;
cin>>n;

char list[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

char ans[1000001];

MappedString(n,0,ans,list);

}

it just that u have like n=123
then in the first recursion call u will gave character to each number n=1=a n=2=b n=3=c
now when u cout<<abc and return from the base condition than
u check if its index is lower than n-1 as now u can take 2 number only and if index is less than or equal to n-2 then u do 2*10+1 then u check if this is less than or equal to 26 then u cout

i get ur point but tell me what is wrong in my code. I need to find out what i am doing wrong

u r doing n%10 uf n=123 than n%10=3 u will get the last but u need front either make it array and use it index wise

recursive approach for java coders