Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //PRE_t=(N ha m*m elementi definiti)
- bool trova(bool *N,int m, int i, int j){
- if(i!= m-1){
- cout<<"Riga "<<i<<" Colonna "<<j<<endl;
- if(*(N+m-1) == 1 && j!=0)
- return trova(N+m-1,m,i+1,j-1);
- if(*(N+m) == 1)
- return trova(N+m,m,i+1,j);
- if(*(N+m+1) == 1 && j!=m-1)
- return trova(N+m+1,m,i+1,j+1);
- else
- return false;
- }//Finchè non sono all'ultima riga
- else
- return true;
- }//trova
- //POST=(restituisce true se in N vista come X[m][m] c’è un cammino da (I,j) alla riga m-1 composto da sole caselle bianche)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement