Вы находитесь на странице: 1из 1

Module Module1

Interface stack
Sub push()
Sub pop()
End Interface
Class Int_stack
Implements stack
Dim a(10) As Integer
Dim top As Integer = 9
Public Sub pop() Implements stack.pop
top += 1
End Sub
Public Sub push() Implements stack.push
Console.WriteLine("Enter no.")
a(top) = Console.ReadLine()
top = top - 1
End Sub
Public Sub display()
Dim i As Integer
For i = top + 1 To 9
Console.WriteLine(a(i))
Next
End Sub
End Class
Sub Main()
Dim ii As New Int_stack
ii.push()
ii.push()
ii.push()
Console.WriteLine("Stack ")
ii.display()
Console.WriteLine("After deletion of top no.")
ii.pop()
ii.display()
End Sub
End Module

Вам также может понравиться