Rabu, 01 Desember 2010

Program Kalkulator

Dim a As Integer
Dim b, x
Dim c As Integer
Dim y As String
Sub Main()

Write("----------------------")
Write("KALAKULATOR SEDERHANA")
Write("----------------------")
WriteLine()
WriteLine()
WriteLine()
Write("--------------------------")
Write("SILAHKAN ISI")
Write("--------------------------")
WriteLine()
WriteLine()
Write("Bilangan 1 : ")
a = ReadLine()
Write("Operator(x,/,+,-) : ")
b = ReadLine()
Write("Bilangan 2 : ")
c = ReadLine()

If b = "x" Then
x = a * c
ElseIf b = "/" Then
x = a / c
ElseIf b = "+" Then
x = a + c
ElseIf b = "-" Then
x = a - c
Else
WriteLine()
Write("!!!MAAF OPERATOR YANG ANDA MASUKAN SALAH!!!")
ReadLine()
Clear()
Call Main()

End If
WriteLine()
Write("Hasilnya adalah : " & x)
ReadLine()
WriteLine()
Write("Ulangi [y/n]? ")
y = ReadLine()
If y = "y" Then
Clear()
Call Main()
Else
Clear()
WriteLine()
WriteLine()
WriteLine()
Write("!!!TERIMA KASIH TELAH MENGGUNAKAN KALKULATOR INI!!!")
WriteLine()
WriteLine()
WriteLine(" .....^_^..... ")
ReadLine()
End

End If
End Sub