全球联系的问题 [英] Global Linked LIst Question

查看:58
本文介绍了全球联系的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序正在创建一个日志并创建一个类并将该类移动到一个全局链表。每个条目都是具有不同元素的同一个类..这样一个元素是int bookEntry,一个是double bookPages ..当程序增长时,如何添加每个列表中包含的bookPages。

好​​的..我没有把它说成最好的..我有一个名为bookInventory的类..这个类是由不同的变量组成,这些变量将信息存储到同一个类的几个不同列表中。所以我需要能够在我的程序中添加所有不同链接列表的bookPages的所有元素,并将它们的总数保持为每个新的条目(链接列表)被添加

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

推荐答案

嗨Gavon,



我猜你使用静态结构体。



您应该使用动态的模板化结构,例如标准清单。您可以使用''push''和''pop''方法控制列表...



我希望它有所帮助。



干杯,

Yass。
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.


这篇关于全球联系的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆