?? codefile1.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 + -