forked from Bandashah/9618-Paper-4-VB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheasy_stack_array.vb
More file actions
37 lines (34 loc) · 855 Bytes
/
easy_stack_array.vb
File metadata and controls
37 lines (34 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Module Module1
Dim stack(4) As String
Dim stptr As Integer
Sub Main()
push("Ahmed Baloch")
push("Abdur Rehman")
push("Ahmed Raza")
push("ImanUllah")
showstack()
pop()
push("jatin")
showstack()
Console.ReadKey()
End Sub
Sub push(ByVal name As String)
If stptr > 4 Then
Console.WriteLine(" stack overflow ")
Exit Sub
End If
stack(stptr) = name
stptr = stptr + 1
End Sub
Sub pop()
stptr = stptr - 1
Console.WriteLine(" The poped element : " & stack(stptr))
End Sub
Sub showstack()
For c = 0 To 4
Console.WriteLine(" the stack ptr " & c & " is " & stack(c))
Console.WriteLine()
Console.ReadKey()
Next
End Sub
End Module