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

📄 codefile1.vb

📁 学习vb过程中老师讲过的所有案例!还有课程设计
💻 VB
字号:
Imports System.windows.forms
Public Class a
    Shared output As String

    Shared Function 部门(ByVal sales As Integer(,), ByVal k As Integer) As Long
        Dim sum As Long = 0
        Dim j As Integer
        For j = 0 To 3
            sum += sales(k, j)
        Next
        Return sum
    End Function

    Shared Function 季度(ByVal sales As Integer(,), ByVal p As Integer) As Long
        Dim total As Long = 0
        Dim i As Integer
        For i = 0 To 4
            total += sales(i, p)
        Next
        Return total
    End Function

    Shared Function buildingstring(ByVal sales As Integer(,))
        output = "      "
        Dim i As Integer
        For i = 0 To 3
            output += " 季度" & i + 1 & "  "
        Next
        Dim m, j As Integer
        For m = 0 To 4
            output += vbNewLine & vbNewLine & "部门" & m + 1 & "    "
            For j = 0 To sales.GetLength(1) - 1
                output += sales(m, j) & "    "
            Next j
        Next m
    End Function
    Shared Sub main()
        Dim i, j As Integer
        Dim sales As Integer(,) = New Integer(,) {{750, 660, 910, 800}, {800, 700, 950, 900}, {700, 600, 750, 600}, {850, 800, 1000, 950}, {900, 800, 960, 980}}
        buildingstring(sales)
        For i = 0 To 4
            output += vbNewLine & vbNewLine & "部门" & i + 1 & "的4季度销售总和是:" & 部门(sales, i) & vbNewLine
        Next
        For j = 0 To 3
            output += vbNewLine & vbNewLine & "5个部门第" & j + 1 & "季度" & "的销售总和是:" & 季度(sales, j) & vbNewLine
        Next

        MessageBox.Show(output, "输出结果")


    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -