Thread: [Linked list] Trying to change this!

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    8

    [Linked list] Trying to change this!

    I've got a linked list that works fairly well that I made several months ago. The problem is that in addition to name and id fields, I now need to add the following:
    1. A one letter code for car type
    2. integer value representing number in stock
    3. cost of vehicle
    4. retail cost
    5. profit on vehicle

    It's been a while since I've touched a list and I would greatly appreciate any help in how to pop in these extra fields.

    [code is attatched]
    Last edited by NebulousMenace; 05-19-2003 at 11:32 PM.

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    The data members at the node have nothing to do with the links. Just add them to the node class, i.e. the class of things that are linked together, and add an appropriate constructor, and any functions you need to manipulate those data members.

    I have a feeling your question boils down to: I've forgotten C++, and can anyone teach me it all over again.
    Last edited by 7stud; 05-20-2003 at 12:10 AM.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    8
    "I have a feeling your question boils down to: I've forgotten C++, and can anyone teach me it all over again."

    With respect to linked lists, this appears to be true. But you gave me the general idea. Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c++builder6 change form names problem
    By Leite33 in forum C++ Programming
    Replies: 2
    Last Post: 06-09-2008, 08:20 AM
  2. how to change static char* and not lose mem ?
    By jabka in forum C Programming
    Replies: 15
    Last Post: 09-07-2007, 05:33 PM
  3. Change Value in an array
    By beginner999 in forum C Programming
    Replies: 3
    Last Post: 01-18-2003, 07:16 AM
  4. Replies: 2
    Last Post: 11-08-2002, 03:22 AM
  5. Replies: 2
    Last Post: 09-04-2001, 02:12 PM