nig*_*f0x 0 c++ algorithm recursion function
int right(int n)
{
if(n>0)
{
n--;
top_lim ++;
cout<<"R";
right_lim--;
if(right_lim < size)
return(right(n-1));
if(top_lim>0)
--> return(up(n - 1));
}
else
{
return 0;
}
}
int up(int n)
{
if(n>1)
{
n--;
top_lim --;
cout<<"U";
if(right_lim < size)
return(right(n-1));
if(top_lim > 0 )
return(up(n-1));
}
else
{
return 0;
}
}
error: [17] 'up' was not declared in this scope|--> indicates error in code ..
Run Code Online (Sandbox Code Playgroud)
问题描述:
问题是在从(0,0)到(n,n)开始的对角线下面的部分找到*n网格中所有可能的路径数量我基本上在主函数中首先调用正确的函数然后它应该打印我所有的路径.
这有解决方法吗?