⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.vb

📁 编程之道VB.NETt程序设计入门-589M.zip
💻 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 + -