扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
Private multi(12, 31) As Integer Private jagged(12)() As Integer |
Private Sub CreateArrays() Dim i As Integer Dim j As Integer Dim random As New Random() ' initialize multi dimension array with random data for each day For i = 0 To 11 For j = 0 To DateTime.DaysInMonth(DateTime.Now.Year, i + 1) - 1 multi(i, j) = random.Next(100) Next Next ' allocate and initialize jagged array with random data For i = 0 To 11 jagged(i) = New Integer(DateTime.DaysInMonth(DateTime.Now.Year, i + 1)) {} For j = 1 To DateTime.DaysInMonth(DateTime.Now.Year, i + 1) - 1 jagged(i)(j) = random.Next(100) Next Next End Sub |
Private Sub TestSquareArray() Trace.Write("Beginning TestSquareArray") Dim i As Integer Dim j As Integer Dim k As Integer Dim sum As Int64 sum = 0 For i = 0 To 65525 For j = 0 To 11 For k = 0 To DateTime.DaysInMonth(DateTime.Now.Year, j + 1) - 1 sum = sum + multi(j, k) Next Next Next Trace.Write("Ending TestSquareArray") End Sub Private Sub TestJaggedArray() Trace.Write("Beginning TestJaggedArray") Dim i As Integer Dim j As Integer Dim k As Integer Dim sum As Int64 sum = 0 For i = 0 To 65525 For j = 0 To 11 For k = 0 To DateTime.DaysInMonth(DateTime.Now.Year, j + 1) - 1 sum = sum + jagged(j)(k) Next Next Next Trace.Write("Ending TestJaggedArray") End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者