Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 14th, 2003, 08:12 AM
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default a question2

Thank you for your answer.
but this is a part of my program:
void pathfind(int x,int y,int **map){


if((x!=1 || y!=5) && (x>=1 && x<=5) && (y>=1 && y<=5)){
y++;
if((y)<=5 && map[y][x]){
count++;

pathfind(x,y,map);

}else{
y=y-(1);
count=0;count1=0;
}
x--;
if((x)>=1 && map[y][x]){
count1++;


pathfind(x,y,map);
}else{
x=x+(1);
count1=0;count2=0;
}
x--;y++;
if((x)>=1 && (y)<=5 && map[y][x]){
count2++;

pathfind(x,y,map);
}else{
x=x+(1);
y=y-(1);
count2=0;count3=0;
}
x--;y--;
if((x)>=1 && (y)>=1 && map[y][x]){
count3++;

pathfind(x,y,map);
}else{
x=x+(1);
y=y+(1);
count3=0;count4=0;
}
y--;
if((y)>=1 && map[y][x]){
count4++;

pathfind(x,y,map);
}else{
y=y+(1);
count4=0;count5=0;
}
x++;y--;
if((x)<=5 && (y)>=1 && map[y][x]){
count5++;

pathfind(x,y,map);
}else{
x=x-(1);
y=y+(1);
count5=0;count6=0;
}
x++;
if((x)<=1 && map[y][x]){
count6++;

pathfind(x,y,map);
}else{
x=x-(1);
count6=0;count7=0;
}
x++;y++;
if((x)<=1 && (y)<=1 && map[y][x]){
count7++;

pathfind(x,y,map);
}

}


}
my problem is that this program check the way only one time
and it doesnot check all of ways for finding shortest way.
what do i do for solving this problem.
Thank you.
regards.

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Question2:How to download information from JSP? Edward King Pro JSP 0 December 19th, 2003 04:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.