RosettaCodeData/Task/Queue-Usage/FreeBASIC/queue-usage.basic

29 lines
835 B
Plaintext

' FB 1.05.0 Win64
#Include "queue_rosetta.bi" '' include macro-based generic Queue type used in earlier task
Declare_Queue(String) '' expand Queue type for Strings
Dim stringQueue As Queue(String)
With stringQueue '' push some strings into the Queue
.push("first")
.push("second")
.push("third")
.push("fourth")
.push("fifth")
End With
Print "Number of Strings in the Queue :" ; stringQueue.count
Print "Capacity of string Queue :" ; stringQueue.capacity
Print
' now pop them
While Not stringQueue.empty
Print stringQueue.pop(); " popped"
Wend
Print
Print "Number of Strings in the Queue :" ; stringQueue.count
Print "Capacity of string Queue :" ; stringQueue.capacity '' capacity should be unchanged
Print "Is Queue empty now : "; stringQueue.empty
Print
Print "Press any key to quit"
Sleep