You are very close! (but it's late and being the Saturday of a very long
week, there is drinking involved)
Shouldn't that be if(n<2)? If n==2 you will call permute(3) which will
cause A[3] = I+1; and there ain't no A[3]
On 11/19/05 8:37 PM, in article
11*********************@g49g2000cwa.googlegroups.c om, "Gaijinco"
<ga******@gmail.com> wrote:
void permute(int n)
{
for(int i=0; i<5; ++i)
{
A[n]=i+1;
if(n<3) ////////////////////// if (n<2) here
{ permute(n+1);
}
else
{ for(int j=0; j<3; ++j)
{ cout << A[j];
} cout << endl;
}
}
}