2011年10月19日 星期三

99資訊月歷屆

https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B1V3ZunitSjAZDAwZGI4YmUtZWFmNS00MTA4LTg3NWQtY2FhMDliMjcxYWVi&hl=zh_TW


>99年表單檔

2 則留言:

  1. 第一題

    Dim cm, t
    Private Sub cmdState_Click(Index As Integer)


    shpMoon.Left = 2280
    shpMoon.Top = 585
    shpMoon.Height = 735
    shpMoon.Width = 855


    Select Case Index
    Case 0
    cm = 0
    Case 1
    cm = 1
    Case 2
    cm = 2
    End Select
    t = 0
    Timer1.Enabled = True
    End Sub

    Private Sub Timer1_Timer()

    Select Case cm
    Case 0
    shpMoon.Top = 600
    shpMoon.Left = shpMoon.Left - 12
    Case 1
    shpMoon.Height = 600
    shpMoon.Width = 700
    shpMoon.Top = 675
    shpMoon.Left = shpMoon.Left - 12
    Case 2
    shpMoon.Top = 800
    shpMoon.Left = shpMoon.Left - 12
    End Select

    t = t + 1
    If t > 160 Then Timer1.Enabled = False
    End Sub

    回覆刪除
  2. 第一題>
    表單檔:-----------------------------------
    https://docs.google.com/uc?id=0B1V3ZunitSjAOWRjZmNkOGItNDNlYy00ZDUxLTljMmEtNDQyOTBkZjA3N2M4&export=download&hl=zh_TW
    EXE檔:-----------------------------------
    https://docs.google.com/uc?id=0B1V3ZunitSjAOWZiNWViYTUtZDVhZC00ZjQ3LWEwYjEtYTQxMmUwYjA2ZGMx&export=download&hl=zh_TW
    -----------------------------------------
    第二題>
    表單檔:-----------------------------------
    https://docs.google.com/uc?id=0B1V3ZunitSjAMWNhNTY4MmUtMWY5NC00Y2ZiLWI4Y2QtODBjY2Q2ODhkNTJi&export=download&hl=zh_TW
    EXE檔:-----------------------------------
    https://docs.google.com/uc?id=0B1V3ZunitSjANGE3MGI3ZjEtYjkwYy00OTNhLWJmMmYtOGQzNDhhZTFmOWQ5&export=download&hl=zh_TW
    -----------------------------------------
    第一題

    Private Sub cmdState_Click(Index As Integer)
    Select Case Index
    Case 0
    ShpMoon.Height = ShpSun.Height
    ShpMoon.Width = ShpSun.Width
    ShpMoon.Top = ShpSun.Top
    ShpMoon.Left = ShpSun.Left + ShpSun.Width
    Timer1.Enabled = True
    Case 1
    ShpMoon.Height = ShpSun.Height - 20
    ShpMoon.Width = ShpSun.Width - 20
    ShpMoon.Top = ShpSun.Top + 20
    ShpMoon.Left = ShpSun.Left + ShpSun.Width - 20
    Timer1.Enabled = True
    Case 2
    ShpMoon.Height = ShpSun.Height
    ShpMoon.Width = ShpSun.Width
    ShpMoon.Top = ShpSun.Top + 200
    ShpMoon.Left = ShpSun.Left + ShpSun.Width - 20
    Timer1.Enabled = True
    End Select
    End Sub


    Private Sub Timer1_Timer()
    If ShpMoon.Left >= ShpMoon.Left Then
    ShpMoon.Left = ShpMoon.Left - 50
    End If
    End Sub

    -------------------------------------


    Dim A() As String
    Dim B() As String
    Dim C() As String

    Private Sub Command1_Click()
    List5.Clear
    Do
    Randomize
    X = List1.List(Int(Rnd * List1.ListCount))
    Y = List2.List(Int(Rnd * List2.ListCount))
    Z = List3.List(Int(Rnd * List2.ListCount))
    W = X & Y & Z
    If Re5(W) = False Then List5.AddItem W
    Loop Until List5.ListCount = Val(Combo1.Text)
    End Sub

    Private Sub Command2_Click()
    N = List1.ListCount
    List1.Clear
    Randomize
    Do
    AA = A(Int(Rnd * N))
    If Re1(AA) = False Then List1.AddItem AA
    Loop Until List1.ListCount = N
    End Sub

    Function Re1(A) As Boolean
    p = False
    For i = 0 To List1.ListCount - 1
    If List1.List(i) = A Then p = True: Exit For
    Next i
    Re1 = p
    End Function

    Function Re2(A) As Boolean
    p = False
    For i = 0 To List2.ListCount - 1
    If List2.List(i) = A Then p = True: Exit For
    Next i
    Re2 = p
    End Function

    Function Re3(A) As Boolean
    p = False
    For i = 0 To List3.ListCount - 1
    If List3.List(i) = A Then p = True: Exit For
    Next i
    Re3 = p
    End Function

    Function Re5(A) As Boolean
    p = False
    For i = 0 To List5.ListCount - 1
    If List5.List(i) = A Then p = True: Exit For
    Next i
    Re5 = p
    End Function

    Private Sub Command3_Click()
    N = List2.ListCount
    List2.Clear
    Randomize
    Do
    BB = B(Int(Rnd * N))
    If Re2(BB) = False Then List2.AddItem BB
    Loop Until List2.ListCount = N
    End Sub

    Private Sub Command4_Click()
    N = List3.ListCount
    List3.Clear
    Randomize
    Do
    CC = C(Int(Rnd * N))
    If Re3(CC) = False Then List3.AddItem CC
    Loop Until List3.ListCount = N
    End Sub



    Private Sub Form_Load()
    For i = 1 To 99
    Combo1.AddItem i
    Next i
    A = Split("甲 乙 丙 丁 戊 己 庚 辛 壬 癸")
    For i = 0 To UBound(A): List1.AddItem A(i): Next i
    B = Split("子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥")
    For i = 0 To UBound(B): List2.AddItem B(i): Next i
    C = Split("鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬")
    For i = 0 To UBound(C): List3.AddItem C(i): Next i
    End Sub

    回覆刪除