ADT

This is a discussion on ADT within the C++ Programming forums, part of the General Programming Boards category; >> I guess i just cant think in terms of ADT maybe i just need to rethink a different major. ...

  1. #16
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> I guess i just cant think in terms of ADT maybe i just need to rethink a different major.

    It's up to you to decide whether you made the right choice or not. But if you really are interested in the field, you probably just need to put a bit more effort into study and practice.

    >> I have worked a week on this project and the sad thing is almost everyone in the class is having the same problems i am having.

    Some teachers are talented at what they do, others are not. Ultimately, though, the onus is on you to learn the material.

  2. #17
    Registered User
    Join Date
    Sep 2006
    Location
    vancouver wa
    Posts
    221
    I got it working!!!!
    Atleast, i can start to create a doubly linked list in my insert function now..
    Problem is the book doesnt really cover initializer list and the teacher has little notes on it.

    Thanks for everyones help! Sorry i didint "Get it" sooner...

    Code:
    list::node::node(const winery &winery) : item(winery.getName(), winery.getLocation(), winery.getAcres(), winery.getRating())
    
    {
    
    item = winery;
    nextByName = NULL;
    nextByRating = NULL;
    
    }
    Code:
    void list::insert(const winery& winery)
    {
    
    
    node* newNode = new node(winery);

  3. #18
    Registered User
    Join Date
    Sep 2009
    Posts
    63
    Congrats on at least getting it started. I think you should read up a bit more on initializer lists and constructors. The Internet has a ton of resources on them.

  4. #19
    Registered User
    Join Date
    Sep 2006
    Location
    vancouver wa
    Posts
    221
    I am trying to insert into a doubly linked list.
    why wont it let me use winery for a compare? What could i use to find if
    the item already exists?

    Code:
    void list::insert(const winery& winery)
    {
    
    //headByName;
    //headByRating;
    
      node *current;
      node * trailcurrent;
      node * newNode;
      bool found;
    
      newNode = new node(winery);
      newNode->item = winery;
      newNode->nextByName = NULL;
    
      if(headByName == NULL)
      {
      headByName = newNode;
      }
      else
      {
      found = false;
      current = headByName;
    
      while(current != NULL && !found)
      if(current->item >= winery)
      found = true;
      else
      {
      trailcurrent = current;
      current = current->nextByName;
      }
    
    }

  5. #20
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Have you define what > means in terms of wineries?

  6. #21
    Registered User
    Join Date
    Sep 2006
    Location
    vancouver wa
    Posts
    221
    No, and i dont know how i would go about doing that.
    The book i am using does something like this.
    Last edited by mrsirpoopsalot; 09-28-2009 at 12:19 AM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with linked list ADT and incomplete structure
    By prawntoast in forum C Programming
    Replies: 1
    Last Post: 04-30-2005, 02:29 AM
  2. Understanding ADT Stack
    By smitsky in forum C++ Programming
    Replies: 8
    Last Post: 11-09-2004, 10:23 PM
  3. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 09:37 AM
  4. Problem with My Sets ADT
    By jawwadalam in forum C++ Programming
    Replies: 2
    Last Post: 10-04-2002, 07:36 AM
  5. ADT Initialization/Passing of Array from Friended ADT
    By Wiggin in forum C++ Programming
    Replies: 1
    Last Post: 04-27-2002, 01:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21