[VB6 ] 輸入一組答案
此程式為先設定一組答案(英文或數字都可)
之後再輸入去猜答案
答對會顯示出來
答錯會要再輸入一次
現在無法設定答案 請幫我看哪裡有錯
Dim answer As String
Dim enteranswer As String
Dim number As Integer
Dim firsttime As Integer
Private Sub Form_Activate()
Print "請設定正確答案"
firsttime = 0
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 32 Then
Print "按下space"
End If
If firsttime = 0 Then
If KeyAscii = 13 Then
firsttime = 1
Cls
Else
amswer = answer + Chr(KeyAscii)
Print answer
End If
Else
enteranswer = enteranswer + Chr(KeyAscii)
number = number + 1
If number = Len(answer) Then
If enteranswer = answer Then
Print "正確答案"
Else
Cls
Print "請重新輸入答案"
enteranswer = ""
number = 0
End If
End If
End If
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc)
※ 編輯: yekome 來自: 220.130.232.109 (10/31 20:04)
→
10/31 20:10, , 1F
10/31 20:10, 1F
推
11/01 01:53, , 2F
11/01 01:53, 2F
→
11/01 13:05, , 3F
11/01 13:05, 3F
推
11/01 15:45, , 4F
11/01 15:45, 4F
→
11/01 15:47, , 5F
11/01 15:47, 5F
→
11/01 19:31, , 6F
11/01 19:31, 6F