NEED HELP URGENTLY FOR C++ program

Discussion in 'Software' started by xusan, Nov 10, 2013.

  1. xusan

    xusan

    Joined:
    Oct 30, 2013
    Messages:
    1
    Problem statement

    A car journey consists of a set of towns and distances (nodes) that are visited in a particular sequence. We require a C++ program that ‘manages’ a collection of nodes and reports the total distance for a given journey. To achieve this the program will request the user to enter each town name and its distance from the last point entered. The first town name entered is ‘start’. When a town name entry of ‘end’ is encountered the program will output to the screen each of the towns visited and the total distance covered by the current journey. The following listing provides an example of how the program is to operate:

    Enter town> staRT
    Enter town> starT
    Enter town> west wyalong
    Enter distance from start> 140
    Enter town> forbes
    Enter distance from west wyalong> 110
    Enter town> paRKes
    Enter distance from forbes> 60
    Enter town> end

    Towns visited> west wyalong, forbes, parkes
    Distance travelled> 310

    Enter town> dubbo
    Enter distance from parkes> 110
    Enter town> end

    Towns visited> west wyalong, forbes, parkes, dubbo
    Distance travelled> 420

    Enter town> halt

    Towns visited> west wyalong, forbes, parkes, dubbo
    Distance travelled> 420

    Program Terminated.

    If ‘start’ is entered at any point for the town name it will cause the logging of towns and distances to be re-initialised. Thus if ‘start’ (any lower or upper case combination accepted) was the provided entry for the last prompt above it would cause the commencement of a new journey.

    An entry of ‘halt’ causes your program to terminate. Prior to terminating your program will list the towns in the current journey and the total accumulated distance via the linked structure. In effect an entry of ‘halt’ has the same effect as entering ‘end’ and then terminating.

    If an entry other than ‘start’, ‘halt’ or ‘end’ was provided then the new entry would be appended to those shown. Refer carefully to the example to note some potential entries that need to be handled by your program.

    In completing this assignment you must create a dynamically linked structure. The nodes in your linked structure will store as data a town name and a distance. In addition each node will need to maintain a pointer to the next node. If there is no next node, a null will be stored
     
    xusan, Nov 10, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave

    need help urgently ARGH

    Dave, Dec 13, 2004, in forum: DVD Video
    Replies:
    4
    Views:
    401
    trollbuster@notrolls.com
    Dec 15, 2004
  2. awhiteford
    Replies:
    3
    Views:
    575
    donnie
    Jan 2, 2005
  3. jazz-player
    Replies:
    0
    Views:
    593
    jazz-player
    Jan 2, 2005
  4. awhiteford
    Replies:
    3
    Views:
    536
    donnie
    Jan 2, 2005
  5. Giuen
    Replies:
    0
    Views:
    1,260
    Giuen
    Sep 12, 2008
Loading...

Share This Page