Public Function insert(x As Integer)
If front = 0& & rear = n - 1 Or rear + 1 = front Then
MsgBox "queue FULL !!!", vbOKOnly, "QUEUE"
ElseIf front = -1 Then
front = rear = 0
ElseIf rear = n - 1 Then
rear = 0
Else
rear = rear + 1
End If
arr(rear) = x
MsgBox x, vbOKOnly, "INSERTED"
List1.AddItem x
End Function
这是循环队列的 insert() 。我在“如果前 = 0& & 后 = n - 1 或后 + 1 = 前然后”
错误是“运行时错误'13'类型不匹配”。