A very basic BASIC calculator

written by Antabax | 4:29:00 PM | | 3 comments »

Finally, on the 3rd day of my training, I managed to figure out the calculator thingy. The coding looks something like this :-
(A short note, it is just a normal direct code hence a beginner's style)


Dim a As Single, b As Single, d As Single
Dim c As String, z As String

Print ""
Print "A simple 2
input Basic Calculator by Azmeer"

Do

Print ""
Input "Please choose a number : ", a
Input "Please choose another number : ", b
Print ""

Print "Choose an operation from the list below"

Print "1. Add"
Print "2. Subtract"
Print "3. Multiply"
Print "4. Divide"
Print ""


Input "Your choice is : ", c


If c = "1" Then
d = a + b
Print "The result of addition is: "; d
End If


If c = "2" Then
d = a - b
Print "The result of subtraction is: "; d
End If


If c = "3" Then
d = a * b
Print "The result of multiplication is: "; d
End If


If c = "4" Then
d = a / b
Print "The result of dividing is: "; d
End If


Print ""
Print "Would you like to calculate again ?"


Print "1. Yes"
Print "2. No"
Print ""


Input "Your choice is : ", z


If z = "1" or z = "Yes" Then
Print ""


ElseIf z = "2" or z = "No" Then
Print ""
Print "Press any key to EXIT"
Exit Do


Else
Print "Invalid choice entered"
Print "Press any key to EXIT"
Exit Do
End If


Loop
Sleep


3 comments

  1. powerplayguy // June 7, 2007 at 5:43 PM  

    hebat2

  2. Anonymous // June 8, 2007 at 2:13 AM  

    if ($time < 4am) && ($tomorrow = $kerja)
    then bprotect.exe /dota arem

  3. buster // June 8, 2007 at 5:18 PM  

    while(int x = 0){
    LOL ;
    x = 0;
    }