Thread: any suggestions?

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    13

    any suggestions?

    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?

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    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?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    http://clusty.com/search?query=short...Mozilla-search
    http://clusty.com/search?query=direc...Mozilla-search
    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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Suggestions and question about bool pointers
    By Akkernight in forum C++ Programming
    Replies: 15
    Last Post: 03-22-2009, 12:27 PM
  2. Free Book Suggestions!
    By valaris in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-08-2008, 10:25 AM
  3. Hi, Suggestions on my program please..
    By Siggy in forum C++ Programming
    Replies: 44
    Last Post: 11-23-2004, 10:55 PM
  4. Need Suggestions
    By Drew in forum C++ Programming
    Replies: 3
    Last Post: 09-18-2003, 05:46 AM
  5. Suggestions.
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 02-06-2002, 12:21 PM