📄 module1.vb
字号:
Module Module1
Sub Main()
Dim i, j, k As Integer
Dim s, t As String
Console.WriteLine("请输入一个除数")
s = Console.ReadLine()
Try
i = Integer.Parse(s)
Catch e As ArgumentNullException
Console.WriteLine("您没有输入")
Catch e As FormatException
Console.WriteLine("您没有输入一个有效的整数")
Catch e As OverflowException
Console.WriteLine("您输入的数字过大或过小")
End Try
Console.WriteLine("请输入被除数")
t = Console.ReadLine()
Try
j = Integer.Parse(t)
Catch e As ArgumentNullException
Console.WriteLine("您没有输入")
Catch e As FormatException
Console.WriteLine("您没有输入一个有效的整数")
Catch e As OverflowException
Console.WriteLine("您输入的数字过大或过小")
End Try
Try
k = i / j
Throw New Exception("自定义的异常")
Catch e As OverflowException
If j = 0 Then
Console.WriteLine("被除数为0!")
Else
Console.WriteLine("运算发生溢出")
End If
Catch e As Exception
Console.WriteLine(e.Source & " " & e.Message)
Finally
Console.WriteLine(k)
End Try
Console.ReadLine()
End Sub
End Module
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -