Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a program that is creating a journal and creating a class and moving that class to a global linked list.. Each entry is the same class with different elements.. such that one element is int bookEntry and one is double bookPages.. How do I add the bookPages that are contained in each list as the program grows.
Ok.. I did not word this the best.. I have a class called bookInventory.. this class is comprised of different variables that are storing information into several different list of the same class.. so I need to be able to add up all the elements of bookPages of all the different linked lists in my program and keep a total of them as each new entry (linked list) is added
Posted
Updated 13-May-13 15:23pm
v2
Comments
Aydin Homay 12-May-13 23:56pm    
I cant understand your question what you want do that please explain more.
CPallini 13-May-13 4:59am    
"Each entry is the same class with different elements"
Do you mean different objects of the same class?
"such that one element is int bookEntry and one is double bookPages"
This is obscure to me.
Please elaborate.
H.Brydon 13-May-13 21:43pm    
This seems to be a duplicate. Either this or the other one should be deleted perhaps?

1 solution

Hi Gavon,

I guess you are using a static structure.

You should use a dynamic 'templated' structure such as the std list. You can control the list with the 'push' and 'pop' methods...

I hope it helps.

Cheers,
Yass.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900