Click here to Skip to main content
13,045,564 members (70,033 online)
Rate this:
Please Sign up or sign in to vote.
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 12-May-13 14:04pm
Updated 13-May-13 15:23pm
AYDIN EBRAHIMI 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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 13 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100