# Thread: shortest path algorithm prob

1. ## shortest path algorithm prob

i nid to find out wat is the shortest path....
user will input values.. then input where wil be his entrnce and exit..

ent_y is the column and ent_x is the row of the entrance entered by the user
ex_y is the column and ex_x is the row of the exit entered also by the user

all values that are added to charing
here's the code... there is something wrong w/ this...i stil cnt find the shortest path

Code:
```	if(ent_y<ex_y&&ent_x<ex_x)
{
for(ai=ent_y;ai<ex_y;ai++)
{  if(ent_x==ex_x)
{ for(bo=ent_y;bo<ex_y;bo++)
}
}
if(path[ent_y+1][ent_x]<path[ent_y][ent_x+1])
{
dong:
if(ent_y+1==ex_y)
{ for(bo=ent_x;bo<ex_x;bo++)
}
}
else
charing+=path[ent_y+1][ent_x];
}
else if(path[ent_y+1][ent_x]>path[ent_y][ent_x+1])
{
dang:
charing+=path[ent_y][ent_x+1];
ai=ent_y;
ent_x=ent_x+ent_x+1;
}
else
{
if(path[ent_y][ent_x+2]>path[ent_y+2][ent_x])
{goto dong;}
else goto dang;
}
}
}
got(30,15); cprintf("value: %d",charing);```

2. Eww..... goto...... this is ugly...... Sorry, but this is going to be hard to walk through.

3. can u suggest a code that will help me determine the shortest path??