誰可以幫我寫一個vb程式 ?? 要有以下的3點~~太感謝了
1.程式要可以倒數時間的(Timer)
2.要是一個數學計算題(加減的就可以了)
3.還有程式自己可以出題目的(亂數)一.一我也不太懂>\"<
這些不知道可以嗎??請大家幫幫忙!!謝謝!!
2006-03-13 08:40:22 · 1 個解答 · 發問者 筱芳 1 in 電腦與網際網路 ➔ 程式設計
老師說.....做一個數學練習題目...亂數出題...
可以出 簡單 中等 困難 可以自動計時時間
時間要倒數 時間到會跳出一個視窗說 時間到了
按確定後還要下一題 (很難吼) >""
2006-03-13 14:50:46 · update #1
謝謝你的回答~對我來說有點難...呵呵>"<
有比較簡單的ㄇ??我測試不太出來~~
2006-03-15 16:00:28 · update #2
'程式有動態引用ScriptControl來做計算的工作,如果還要寫+-*/的程式怕塞不下,直接貼上CODE就可Dim A, O(2) As OptionButton, T As TextBox, L As Label, H%, V As ObjectDim WithEvents C As CommandButton, WithEvents M As TimerPrivate Sub C_Click()If C.Caption = "出題" Then C.Caption = "回答": Cal: M.Enabled = TrueElse C.Caption = "出題": M.Enabled = False On Error Resume Next If V.Eval(L & "=" & Trim(T)) Then If Err Then msg 0 Else msg 1 End If Else msg 0 End IfEnd IfEnd SubSub msg(X)If X = 0 Then S = "錯誤"ElseIf X = 1 Then S = "正確"Else S = "時間到"End IfIf MsgBox(S & ",是否繼續?", 4) = 6 Then C.Value = TrueEnd SubPrivate Sub Form_Load()Dim I%Set V = CreateObject("ScriptControl")V.Language = "VBScript"A = Array("+", "-", "*", "/")For I = 0 To 2 Set O(I) = Controls.Add("VB.OptionButton", "O" & I) O(I).Visible = True: O(I).Left = I * O(0).WidthNextO(0).Caption = "簡單": O(1).Caption = "中等": O(2).Caption = "困難"Set L = Controls.Add("VB.Label", "L")L.Width = 3345: L.Top = 500: L.BorderStyle = 1L.Height = 255: L.Visible = TrueSet T = Controls.Add("VB.TextBox", "T")T.Width = 3345: T.Top = 780: T.Height = 255: T.Visible = TrueSet C = Controls.Add("VB.CommandButton", "C")C.Width = 945: C.Top = 1150: C.Height = 405C.Caption = "出題": C.Visible = TrueSet M = Controls.Add("VB.Timer", "M")M.Interval = 1000: M.Enabled = FalseEnd SubSub Cal()Dim I%, J%, N%, R%, E%, S As StringT = "": T.SetFocus: Caption = ""If O(0) Then N = 3ElseIf O(1) Then N = 4Else N = 5End IfRandomize: H = N * 10For I = 1 To N R = Int(Rnd * (N - 1) + 1) For J = 1 To R Do E = Int(Rnd * 10) Loop Until (J = 1 And E > 0) Or J > 1 S = S & E Next R = Int(Rnd * 4) S = S & A(R)NextL = Left(S, Len(S) - 1)End SubPrivate Sub Form_Unload(Cancel As Integer)Set V = NothingEnd SubPrivate Sub M_Timer()If H > 0 Then H = H - 1 Caption = H & "秒"Else C.Caption = "出題": M.Enabled = False msg 2End IfEnd Sub
2006-03-13 21:18:49 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋