Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Игра познай числото; 23.02.2022 автор Илия Попов
- Option Explicit On
- Option Strict On
- Imports System
- Module Program
- Function inputNumber() As Integer
- Dim n As Integer
- Console.Write("Въведете число в диапазона 1-20:")
- If Integer.TryParse(Console.ReadLine(), n) Then
- Return n
- Else
- Return 0
- End If
- End Function
- Function rndNumber() As Integer
- Randomize()
- Return CInt(Int(19 * Rnd()) + 1)
- End Function
- Sub banner()
- Console.WriteLine("Игра познай числото")
- End Sub
- Function result(ByRef cpValue As Integer, ByRef plValue As Integer) As String
- Dim value As String
- Select Case plValue
- Case Is < cpValue
- value = "Бонус: Числото е по-голямо!"
- Case Is > cpValue
- value = "Бонус: Числото е по-малко!"
- Case Is = cpValue
- Console.Clear()
- value = "Познахте числото!"
- Case Else
- value = "Не познахте числото!"
- End Select
- Return value
- End Function
- Sub move()
- Dim a, b As Integer
- a = rndNumber()
- Do
- b = inputNumber()
- Console.WriteLine(result(a, b))
- Loop Until a = b
- End Sub
- Sub gameOver()
- Console.WriteLine("Спечелихте играта свърши!")
- End Sub
- Sub appRun()
- banner()
- move()
- gameOver()
- End Sub
- Sub Main(args As String())
- appRun()
- Console.ReadKey()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment