Modifying Link List node information

Im trying to use the standard library and use the Link List to store information that I am reading in from a file, but I need to modify the information to be held by the listnode.

Example:
string bookTitle;
int bookPrice;
string bookAuthor;
etc...
What's the question?
How do I modify the data structure in the LList, which is in the standard library. Can I use a struct in source code to modify the contents of the Listnode so that instead of having 2 pointers and a data slot, that it has 2 pointers and 5 data slots...
I see "how do I change stuff" questions a lot on here.

Isn't the assignment operator like one of the first thing you learn in C++?

 
whateveryouwanttochange = whateveryouwanttochangeitto;


Anyway, LList is not in the standard library, so if you're using something called LList, we'd need to see it in order to tell you how to use it. However if you are in fact using std::list (which is the standard lib linked list class), then it's pretty simple:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
struct BookInfo
{
  string bookTitle;
  int bookPrice;
  string bookAuthor;
};

//...

std::list<BookInfo> lst;

BookInfo book;
book.bookTitle = "title of the book";
book.bookPrice = 49;
book.bookAuthor = "me";

lst.push_back(book);

Sorry, I remember calling it LList in class, but you are correct in stating that i'm using std::list.

Now do I put that in my main source code?
Because I'm going to have my main.cpp, author.h, author.cpp, book.h, and book.cpp.

The author and book files are used to read in the information into my link list. And my main holds the program in which I have a menu running in order to have the user select options to choose from...
Topic archived. No new replies allowed.