Command Prompt Style Application

Use this board to post your code snippets - tips and tricks
6 posts Page 1 of 1
Contributors
User avatar
goldfox453
Just Registered
Just Registered
Posts: 9
Joined: Sun Nov 07, 2010 3:01 am

Command Prompt Style Application
goldfox453
A simple module to show you how to create a command prompt style application
Code: Select all
Module Module1
    Dim a As Integer
    Dim b As Integer
    Dim c As Integer
    Sub Main()
        Console.WriteLine("Type ! for help Creator:Chris Johnson Email:chris-johnson11@hotmail.com")
        a = 0
        b = 0
        c = 0
        start()
    End Sub
    Sub start()
        Dim s As String
        Console.Write(">")
        s = Console.ReadLine
        If s = "#a" Then numa() Else 
        If s = "#b" Then numb() Else 
        If s = "@" Then compile() Else 
        If s = "a" Then MsgBox("#A is " & a, MsgBoxStyle.Information, "#A") Else 
        If s = "b" Then MsgBox("#B is " & b, MsgBoxStyle.Information, "#B") Else 
        If s = "!" Then help() Else 
        If s = "clr" Then Console.Clear() : Main() Else 
        Console.WriteLine("That is not a command type: ! for help")
        start()
    End Sub
    Sub numa()
        Console.Write("Vaule For integer A:")
        Try
            a = Console.ReadLine
        Catch
            Console.WriteLine("Please Enter A Number")
            numa()
        End Try
        start()
    End Sub
    Sub numb()
        Console.Write("Vaule For Integer B:")
        Try
            b = Console.ReadLine()
        Catch
            Console.WriteLine("Please Emter A Number")
            numb()
        End Try
        start()
    End Sub
    Sub help()
        Console.WriteLine("Commands:")
        Console.WriteLine("!-Get Help")
        Console.WriteLine("#a-Sets Vaule Of Integer a ")
        Console.WriteLine("#b-Sets Vaule Of Integer b ")
        Console.WriteLine("@-choose operation")
        Console.WriteLine("a-view vaule of the a integer")
        Console.WriteLine("a-view vaule of the b integer")
        Console.WriteLine("clr-Clear Window")
        start()
    End Sub
    Sub compile()
        Dim s As String
        Console.Write("What Operation(+,-,x,/):")
        s = Console.ReadLine
        If s = "+" Then c = a + b Else 
        If s = "-" Then c = a - b Else 
        If s = "x" Then c = a * b Else 
        If s = "/" Then c = a / b Else 
        Console.WriteLine("Out: " & c)
        start()
    End Sub
End Module
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Re: Command Prompt Style Application
AnoPem
This is not a tutorial?
https://t.me/pump_upp
User avatar
clanc789
Coding Guru
Coding Guru
Posts: 786
Joined: Tue Nov 02, 2010 4:45 pm

Please us the ' character to comment your lines so people can learn from it.
Practice makes perfect!

VIP since: 6-10-2011
User avatar
AquuL
Just Registered
Just Registered
Posts: 8
Joined: Tue Aug 09, 2011 6:16 pm

Re: Command Prompt Style Application
AquuL
Sorry for saying that, but this is FAIL TUTORIAL!
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Command Prompt Style Application
mandai
If you are smart you can use logic to figure out what the code is doing.
User avatar
clanc789
Coding Guru
Coding Guru
Posts: 786
Joined: Tue Nov 02, 2010 4:45 pm

mandai wrote:
If you are smart you can use logic to figure out what the code is doing.
It would thenagain be a code snippet instead of a tut. A tut is used to explain the usage of a piece of code, but correct me if im wrong though.
Practice makes perfect!

VIP since: 6-10-2011
6 posts Page 1 of 1
Return to “Quick Snips”