私はちょうど Visual Basic を学んでいます。電卓を作ってみたけど欲しいのでif文にないものがあると「ごめん」と言って最初に戻る。コードは次のとおりです。
Module Module1
Sub Main()
Dim num1 As Integer
Dim num2 As Integer
Dim op As String
Console.WriteLine("Calculator")
Console.WriteLine(" ")
Console.WriteLine("Valid Operators :")
Console.WriteLine("+(Addition), -(Subtraction), *(Multiplication) & /(Division)")
Console.WriteLine(" ")
Console.WriteLine("Enter Number 1 :")
num1 = Console.ReadLine()
Console.WriteLine(" ")
Console.WriteLine("Enter Number 2 :")
num2 = Console.ReadLine()
Console.WriteLine(" ")
Console.WriteLine("Enter Operator :")
op = Console.ReadLine()
If op = "+" Then
Console.WriteLine(" ")
Console.WriteLine("Answer :")
Console.WriteLine(num1 + num2)
Console.WriteLine(" ")
Console.WriteLine("Press <Enter> To Exit")
Console.ReadLine()
End If
If op = "-" Then
Console.WriteLine(" ")
Console.WriteLine("Answer :")
Console.WriteLine(num1 - num2)
Console.WriteLine(" ")
Console.WriteLine("Press <Enter> To Exit")
Console.ReadLine()
End If
If op = "*" Then
Console.WriteLine(" ")
Console.WriteLine("Answer :")
Console.WriteLine(num1 * num2)
Console.WriteLine(" ")
Console.WriteLine("Press <Enter> To Exit")
Console.ReadLine()
End If
If op = "/" Then
Console.WriteLine(" ")
Console.WriteLine("Answer :")
Console.WriteLine(num1 / num2)
Console.WriteLine(" ")
Console.WriteLine("Press <Enter> To Exit")
Console.ReadLine()
End If
If op = Nothing Then
Console.WriteLine(" ")
Console.WriteLine("You have not entered a valid operator.")
Console.WriteLine(" ")
Console.WriteLine("Press <Enter> To Exit")
Console.ReadLine()
End If
End Sub
End Module
誰でも助けてもらえますか?