vb.net 交错 处理 一年中的月份天数的输出

页面导航:首页 > 软件编程 > vb.net > vb.net 交错 处理 一年中的月份天数的输出

vb.net 交错 处理 一年中的月份天数的输出

来源: 作者: 时间:2016-01-18 16:54 【

处理一年中的月份天数的输出知识点 :数组+交错[vb]Module Module1 Sub Main() Dim calendars()() As Double = New Double(11)() {} Dim month As Integer Dim days As Integer Dim dayVa...

处理一年中的月份天数的输出

知识点 :

数组+交错

 

[vb]
Module Module1 
 
    Sub Main() 
        Dim calendars()() As Double = New Double(11)() {} 
        Dim month As Integer 
        Dim days As Integer 
        Dim dayValue, i As Integer 
        For month = 0 To 11 
            days = DateTime.DaysInMonth(Year(Now), month + 1) 
            calendars(month) = New Double(days - 1) {} 
            i = 0 
            For Each dayValue In calendars(month) 
                calendars(month)(i) = i + 1 
                i += 1 
            Next 
        Next month 
 
 
        For month = 0 To 11 
            i = 0 
            Console.WriteLine("{0}月", month + 1) 
            For Each dayValue In calendars(month) 
                Console.Write("  {0}", calendars(month)(i)) 
                i += 1 
            Next 
            Console.WriteLine() 
        Next month 
 
 
 
        Console.ReadLine() 
    End Sub 
 
End Module 

Module Module1

    Sub Main()
        Dim calendars()() As Double = New Double(11)() {}
        Dim month As Integer
        Dim days As Integer
        Dim dayValue, i As Integer
        For month = 0 To 11
            days = DateTime.DaysInMonth(Year(Now), month + 1)
            calendars(month) = New Double(days - 1) {}
            i = 0
            For Each dayValue In calendars(month)
                calendars(month)(i) = i + 1
                i += 1
            Next
        Next month


        For month = 0 To 11
            i = 0
            Console.WriteLine("{0}月", month + 1)
            For Each dayValue In calendars(month)
                Console.Write("  {0}", calendars(month)(i))
                i += 1
            Next
            Console.WriteLine()
        Next month

 

        Console.ReadLine()
    End Sub

End Module


 

运行效果:

 \

 


Tags:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<