-1
Public Class pros_stack
Dim stk As New Stack(Of barang)
Private Sub beli(ByVal brg As barang)
stk.Push(brg)
stock += brg.jml
End Sub
Private Function jual() As barang
Dim hps As barang = stk.Pop
stock -= hps.jml
Return hps
End Function
Public Sub proses()
Dim putar As Boolean = True
Dim pilih As Integer
Dim new_brg As barang
'
Console.Clear()
history.Clear()
'
Try
Console.WriteLine(" Proses STACK")
Console.WriteLine(" ------------")
While putar
Console.WriteLine(" Menu")
Console.WriteLine(" 1. Beli")
Console.WriteLine(" 2. Jual")
Console.WriteLine(" 3. Selesai")
Console.WriteLine()
Console.Write("Pilih : ")
pilih = Console.ReadLine
If pilih = 1 Then ' BELI
Console.WriteLine(" Proses Beli")
Console.WriteLine(" ----------")
Console.Write("Jumlah Barang : ")
new_brg.jml = Console.ReadLine
Console.Write("Harga Satuan : ")
new_brg.hrg = Console.ReadLine
如何在Visual Basic中實現類似上面的堆棧代碼,有人可以給我參考。如何用多個變量推送數組對象。像new_brg.jml和new_brg.hrg一樣成爲java中的一個堆棧對象。implement從VisualBasic到Java的堆棧netbeans