队列实施 [英] Queue Implementation

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

问题描述

嗨。


有谁知道如何在VB6.0中实现队列?


我只需要推送功能推送结束queue和pop从队列顶部删除一个项目。

Hi.

Does anyone know how to implement queue in VB6.0 ?

I just need the push function to push end of queue and pop to remove an item from top of the queue.

推荐答案


有谁知道如何实现队列在VB6.0中?
Does anyone know how to implement queue in VB6.0 ?



当然,只需编写几个函数来添加和删除数组中的内容。

Sure, just write a couple of functions to add and remove things in an array.





您还可以使用未排序的ListBox作为队列,


要添加:

List1.AddItem" ABCD" ,0

''这个添加到顶部


到PopOut最后一项:

str1 = List1.List(List1.ListCount -1)

List1.RemoveItem List1.ListCount-1

与Killer建议的数组相同。

但是使用ListBox很容易,你不必遍历所有项目以向下推,只需将AddItem置于0,确保其他Listitems被推下。

REgards

Veena
Hi,

You can also use non-sorted ListBox as a Queue,

To Add :
List1.AddItem "ABCD", 0
''This Adds on Top

To PopOut Last item :
str1 = List1.List(List1.ListCount-1)
List1.RemoveItem List1.ListCount-1

Same thing you can do with array as Killer suggested.
But ease with ListBox is, you don''t have to loop through all the items to Push Down, just AddItem at 0, ensures, other Listitems are pushed down.

REgards
Veena



您好,您也可以使用未排序的ListBox作为队列...
Hi, You can also use non-sorted ListBox as a Queue ...



您必须使用数组或指针进行队列操作。控件不是更好的例子(当然我们可以实际使用)。但从逻辑上讲,在Listbox中我们可以使用索引值从列表中间删除项目,并更改下一个索引的值,该值不应该发生在队列(FIFO)中。

You have to use Array or pointer for Queue operation. Controls will not be a better example (of course we can use practically). But logically, in Listbox we can remove items from the middle of list using index value and change value for next index which should not happen in queue (FIFO).


这篇关于队列实施的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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