1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Pointers and Lists

Discussion in 'C' started by bricemfr, Dec 20, 2011.

  1. bricemfr

    bricemfr New Member

    Joined:
    Dec 20, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello, Im very very new at C++, I have this assignment that I can't figure out, if anybody could me, I'll be very grateful.


    Create a List class with the following interface (at a minimum):
    bool addItem(Node&) //add an item to the list, return true on success
    Node* getLargestNode( ) //return the largest value stored in the list
    In addition, create a Node class that stores an integer. The Nodes will be linked together to form the List. Your driver program should accept ten integers from the console, create new Nodes, store them in the list, then display the largest value in the list.
    You'll end up with at least two objects: the List object, and the Node object. You’ll want to think about what a node is and what a list is, and what behaviors each should have. For example, the List shouldn’t store the highest integer in the list…instead it should ask each Node its value, and if the Node contains the highest value the List has seen, it should store a pointer to that Node.
    getLargestNode( ) should iterate the list…start at the top and look at each node in turn until it reaches the bottom of the list. It returns a Node, so you can use the method in main( ) to find and print the value of the largest node.

    Thank you
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Moved thread from Introduction to C-C++ forum
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Your best bet is to tell your tutor that he's way ahead of you. If you haven't even got a clue where to start with this one, either he's assuming a level of knowledge you don't have, or you've been slacking off in the earlier classes.....
     

Share This Page