Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 我需要设计一个程序,使用vb控制台(vb net)输出给定日期的一周中的特定日期_Vb.net_Date_If Statement - Fatal编程技术网

Vb.net 我需要设计一个程序,使用vb控制台(vb net)输出给定日期的一周中的特定日期

Vb.net 我需要设计一个程序,使用vb控制台(vb net)输出给定日期的一周中的特定日期,vb.net,date,if-statement,Vb.net,Date,If Statement,根据公式,我认为它应该有效,但事实并非如此。这给了我不合适的一天。也许因为我们还需要计算闰年?我需要简单的vb网络代码。对我来说,你展示的公式是不必要的复杂,因为有一个内置的方法来实现你想要的 那么,仅仅: Module Module1 Sub Main() Dim N, d, m, y, T As Integer Console.Write("Enter the date(DD): ") Console.ReadLine()

根据公式,我认为它应该有效,但事实并非如此。这给了我不合适的一天。也许因为我们还需要计算闰年?我需要简单的vb网络代码。

对我来说,你展示的公式是不必要的复杂,因为有一个内置的方法来实现你想要的

那么,仅仅:

Module Module1

    Sub Main()
        Dim N, d, m, y, T As Integer

        Console.Write("Enter the date(DD): ")
        Console.ReadLine()
        Console.Write("Enter the month(MM): ")
        Console.ReadLine()
        Console.Write("Enter the year(YY): ")
        Console.ReadLine()


        N = d + 2 * m + (3 * (m + 1) / 5) + y + (y / 4) - (y / 100) + (y / 400) + 2
        T = N Mod 7 - 1
        If T = 1 Then
            Console.Write("The day is Monday")
            Console.ReadLine()
        ElseIf T = 2 Then
            Console.Write("The day is Tuesday")
            Console.ReadLine()
        ElseIf T = 3 Then
            Console.Write("The day is Wednesday")
            Console.ReadLine()
        ElseIf T = 4 Then
            Console.Write("The day is Thursday")
            Console.ReadLine()
        ElseIf T = 5 Then
            Console.Write("The day is Friday")
            Console.ReadLine()
        ElseIf T = 6 Then
            Console.Write("The day is Saturday")
            Console.ReadLine()
        ElseIf T = 7 Then
            Console.Write("The day is Sunday")
            Console.ReadLine()

        End If
    End Sub

End Module

对我来说,你展示的公式是不必要的复杂,因为有一种内在的方式来实现你想要的

那么,仅仅:

Module Module1

    Sub Main()
        Dim N, d, m, y, T As Integer

        Console.Write("Enter the date(DD): ")
        Console.ReadLine()
        Console.Write("Enter the month(MM): ")
        Console.ReadLine()
        Console.Write("Enter the year(YY): ")
        Console.ReadLine()


        N = d + 2 * m + (3 * (m + 1) / 5) + y + (y / 4) - (y / 100) + (y / 400) + 2
        T = N Mod 7 - 1
        If T = 1 Then
            Console.Write("The day is Monday")
            Console.ReadLine()
        ElseIf T = 2 Then
            Console.Write("The day is Tuesday")
            Console.ReadLine()
        ElseIf T = 3 Then
            Console.Write("The day is Wednesday")
            Console.ReadLine()
        ElseIf T = 4 Then
            Console.Write("The day is Thursday")
            Console.ReadLine()
        ElseIf T = 5 Then
            Console.Write("The day is Friday")
            Console.ReadLine()
        ElseIf T = 6 Then
            Console.Write("The day is Saturday")
            Console.ReadLine()
        ElseIf T = 7 Then
            Console.Write("The day is Sunday")
            Console.ReadLine()

        End If
    End Sub

End Module

谢谢你的帮助。你的回答真的很有帮助。谢谢你的帮助。你的回答真的很有帮助。