| |

VerySource

 Forgot password?
 Register
Search
View: 1476|Reply: 11

Find a piece of VB source code, use call to call, find the year of 2010 to 2050

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-7 08:00:01
| Show all posts |Read mode
Find a piece of VB source code, use call to call, find the year of 2010 to 2050
Reply

Use magic Report

0

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-3-28 22:15:01
| Show all posts
Function a ()
    Dim i&, j&, k
    ReDim k ((2050-2012)\4)
    
    For i = 2012 To 2050 Step 4
        k (j) = i
        j = j + 1
    Next
    
    a = k
End Function
Reply

Use magic Report

0

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-3-28 23:15:02
| Show all posts
Has been debugged
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-3-29 09:15:01
| Show all posts
I want to use the form of a subroutine call
Reply

Use magic Report

0

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-3-30 08:00:01
| Show all posts
Impossible to call with CALL -_-
The function called with call cannot get the return value -_-
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-3-30 23:00:01
| Show all posts
Public Sub FindLeap ()
n = 0
Y = 2010
Do Until (Y> 2050)
If Y Mod 4 = 0 Then
    If (Y Mod 100) <> 0 Then
    leap = 1
    ElseIf (Y Mod 400) = 0 Then
    leap = 1
        Else
        leap = 0
    End If
Else
leap = 0
End If
If leap = 1 Then
   Print Y;
   n = n + 1
If n Mod 5 = 0 Then
Print
End If
Y = Y + 1
Loop
End Sub

Private Sub cmdleap_click ()
Print "Leap years between 2010 and 2050:"
Call FindLeap
End Sub


When running, prompt Loop is missing do ????
Reply

Use magic Report

0

Threads

11

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-4-3 03:00:01
| Show all posts
Private Sub FindLeap ()
    Dim i As Long
    
    For i = 2010 To 2050
        If IsDate (CStr (i)&"-2-29") Then
            Debug.Print i
        End If
    Next
End Sub
Reply

Use magic Report

0

Threads

34

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-4-13 10:45:01
| Show all posts
Public Sub FindLeap ()
n = 0
Y = 2010
Do Until (Y> 2050)
    If Y Mod 4 = 0 Then
        If (Y Mod 100) <> 0 Then
            leap = 1
        ElseIf (Y Mod 400) = 0 Then
            leap = 1
        Else
            leap = 0
        End If
    Else
        leap = 0
    End If
    If leap = 1 Then
       Print Y;
       n = n + 1
        If n Mod 5 = 0 Then Print 'There is a problem here, if end if does not match
    End If
    Y = Y + 1
Loop
End Sub

Private Sub cmdleap_click ()
Print "Leap years between 2010 and 2050:"
Call FindLeap
End Sub
Reply

Use magic Report

0

Threads

34

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-4-13 11:45:01
| Show all posts
Public Sub FindLeap ()
n = 0
Y = 2010
Do Until (Y> 2050)
    If Y Mod 4 = 0 Then
        If (Y Mod 100) <> 0 Then
            leap = 1
        ElseIf (Y Mod 400) = 0 Then
            leap = 1
        Else
            leap = 0
        End If
    Else
        leap = 0
    End If
    If leap = 1 Then
       Print Y;
       n = n + 1
        If n Mod 5 = 0 Then Print 'change it here
    End If
    Y = Y + 1
Loop
End Sub

Private Sub cmdleap_click ()
Print "Leap years between 2010 and 2050:"
Call FindLeap
End Sub
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-4-18 17:30:01
| Show all posts
'TO is running, it prompts Loop is missing do ????

If leap = 1 Then
   Print Y;
   n = n + 1
If n Mod 5 = 0 Then
Print
End If


'Change to
    If leap = 1 Then
      Print Y;
      n = n + 1
    End If
    If n Mod 5 = 0 Then
      Print
    End If
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list