Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Dim Selection As Integer
- Sub Main()
- While Selection <> 4
- Menu()
- GetOption()
- Select Case Selection
- Case 1
- Factorial()
- Case 2
- AddThreeNumbers()
- Case 3
- FindFirstBlank()
- Case 4
- Goodbye()
- End Select
- End While
- End Sub
- Sub Menu()
- Console.WriteLine("Which Calculation would you like to perform?")
- Console.WriteLine("--------------------------------------------")
- Console.WriteLine("1 Factorial")
- Console.WriteLine("2 Add three numbers together")
- Console.WriteLine("3 Find First Blank")
- Console.WriteLine("4 Quit")
- Console.WriteLine()
- End Sub
- Sub GetOption()
- Selection = Console.ReadLine
- While Selection < 1 Or Selection > 4
- Console.WriteLine("You appear to have made a mistake Please try again")
- Menu()
- Selection = Console.ReadLine
- End While
- End Sub
- Sub Factorial()
- Dim counter As Integer
- Dim total As Integer = 1
- Dim FactEntry As Integer
- Console.WriteLine("Which number would you like to find the factorial for?")
- FactEntry = Console.ReadLine
- For counter = FactEntry To 1 Step -1
- total = total * counter
- Next counter
- Console.WriteLine(FactEntry & " Factorial is " & total)
- Console.WriteLine()
- End Sub
- Sub Goodbye()
- Console.WriteLine("Goodbye and thanks for all the fish")
- Wait()
- End Sub
- Sub Wait()
- For i = 1 To 1000000000
- Next
- End Sub
- Sub AddThreeNumbers()
- Dim numberone As Integer
- Dim numbertwo As Integer
- Dim numberthree As Integer
- Dim added As Integer
- Console.WriteLine("Enter number one")
- numberone = Console.ReadLine
- Console.WriteLine("Enter number two")
- numbertwo = Console.ReadLine
- Console.WriteLine("Enter number three")
- numberthree = Console.ReadLine
- added = numberone + numbertwo + numberthree
- Console.WriteLine("The total is: " & added)
- Console.WriteLine()
- End Sub
- Sub FindFirstBlank()
- Dim i As Integer
- Dim Line As String
- Dim character As Integer = 0
- Console.WriteLine("Please enter a string")
- Line = Console.ReadLine
- For i = 1 To Len(Line)
- If Mid(Line, i, 1) = " " Then
- Console.WriteLine("The space is at: " & i)
- End If
- Next
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement