stack..??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dreams
    New Member
    • Nov 2006
    • 11

    stack..??

    hi every one

    would any one give me only functions prototypes of the folowing program..

    suppose i have patients and i want store their names' and medicines'
    those patients i want store them in a stack,,
    i don't know how to implement that..
    thanks alot :)
  • svlsr2000
    Recognized Expert New Member
    • Feb 2007
    • 181

    #2
    Originally posted by dreams
    hi every one

    would any one give me only functions prototypes of the folowing program..

    suppose i have patients and i want store their names' and medicines'
    those patients i want store them in a stack,,
    i don't know how to implement that..
    thanks alot :)
    Do you want to implement your own stack or you want to store in programs stack

    Comment

    • dreams
      New Member
      • Nov 2006
      • 11

      #3
      Originally posted by svlsr2000
      Do you want to implement your own stack or you want to store in programs stack

      i want to implement in my stack :)

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Use a linked list for your stack.

        The "push" adds an element to the end of the list.

        The "pop" removes the element at the end of the list

        The "front" returns the value of the data from the node at the end oif the list.

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by weaknessforcats
          Use a linked list for your stack.

          The "push" adds an element to the end of the list.

          The "pop" removes the element at the end of the list

          The "front" returns the value of the data from the node at the end oif the list.
          What's wrong with a vector<patient> class then?

          kind regards,

          Jos

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            Nothing. However, with the STL I would use stack<patient>.

            I thought the intent was to write a stack and not just use one.

            Comment

            Working...