using C++.net, making a windows form project thingy.
this program i have will be finding a city of the location, location is entered by choosing a direction, a freeway, and the exit.
my question is the "find city" button have LOTS of different scenarios, becaue there are atleast 25 freeways and an average of 15 exits per freeway.
so instead of "if" and "else"ing my self to death, is there a loop that i can utilize for this?
If I understand it correctly, you'll probably need a way to describe the network of ways/cities/locations. And yes, that doesn't mean if else'ing the map of the world, but using some appropriate data structure to describe each "place" in this world, and its relation to other "places".
Does your program have any input, the description of the world?
Each segment of your freeway has a cost associated with it, which could either be
- the time it takes to travel it's length (which may vary by time of day say)
- the actual length of the segment.
The rest is just building data structures to represent the network of cities and roads (that's the DAG), and the code to work out what the minimum distance is.