Imports microsoft.visualbasic
Dim freeptr as integer = 0
Dim frstptr as integer = 0
Dim lastptr as integer = 0
arr(i).pointer = nullpointer
console.writeline("Enter 'del' to take a node out of the queue")
console.writeline("Enter 'inp' to add a node to the queue")
console.writeline("Enter 'prt' to view the current queue")
console.writeline("Enter 'esc' to end the program")
console.writeline("Enter action")
delete(arr, frstptr, inuse)
input(arr, freeptr, lastptr, inuse)
print(arr, frstptr, inuse)
console.writeline("Invalid entry")
checkforfree(arr, freeptr)
loop until Lcase(inp) = Lcase("esc")
public sub checkforfree(arr() as node, ByRef free as integer)
public sub delete(arr() as node, ByRef first as integer, inuse as integer)
console.writeline("Sorry, the queue is empty :(")
console.writeline("{0} was taken out of the queue", arr(first).value)
temp = arr(first).pointer
arr(first).pointer = nullpointer
public sub input(arr() as node, free as integer, ByRef last as integer, inuse as integer)
console.writeline("Sorry, the queue is full :(")
console.writeline("Enter value")
arr(free).pointer = nullpointer
public sub print(arr() as node, first as integer, inuse as integer)
dim pointtonext as integer = first
console.writeline("The queue is currently empty")
console.writeline("The queue currently contains the following:")
console.writeline(arr(pointtonext).value)
pointtonext = arr(pointtonext).pointer
loop until pointtonext = nullpointer
public const nullpointer as integer = -1