$Heap_is_empty = Win32API.new('heap.dll', 'is_empty', 'v', 'i') #檢查是否為空 $Heap_clear = Win32API.new('heap.dll', 'clear', 'v', 'v') #清空 $Heap_push = Win32API.new('heap.dll', 'push', 'ii', 'v') #放入,第一個為優先度,第二個為儲存之數值 $Heap_top = Win32API.new('heap.dll', 'top', 'v', 'i') #取頂部,回傳第二個數值 $Heap_pop = Win32API.new('heap.dll', 'pop', 'v', 'v') #推出 $Heap_clear.call() $Heap_push.call(1,2) $Heap_push.call(3,4) $Heap_push.call(-1,9) if $Heap_is_empty.call() == 0 p $Heap_top.call() #4 $Heap_pop.call() p $Heap_top.call() #2 $Heap_pop.call() p $Heap_top.call() #9 $Heap_pop.call() end
208.59 KB, 下载次数: 66
Heap
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |