当用户选择好一个答案并单击“下一题目后”可以做下一个题目。当做完最后一个题目时弹出对话框提示用户已经做完所有的练习。把用户的所有答案以及得分记录下来并保存到一个文本文件中。文件名自定。为了简单,只考虑一篇文章,有10个选择题,每个题目10分。基本框架如图,求完善····TAT  不会做啊····

解决方案 »

  1.   

    定义 2 个窗体级的数组变量 
    Dim Choice(9) As String, Points As Integer
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    Private Sub Button3_Click(......)
    Dim tmp As String
        For j = 1 To 4
            If Me.Controls.Item(j - 1).Value = True Then
                tmp = Chr(64 + j)
                Choice(i) = tmp
                If tmp = a(i, 5) Then Points = Points + 10
                Exit For    
            End If
        Next j    If j = 5 Then
            MsgBox("请选择答案")
            Exit Sub
        End If    i = i + 1
        If i = 10 Then
            MsgBox("你已完成所有测试。请查看你的成绩并点击退出")
            Open Application.Path & "\test_result,txt" For Output As #1
            For j = 0 To 9
                Print #1, a(j, 0) 
                Print #1, "Answer: " & a(j, 5)
                Print #1, "Your Choice: " & Choice(j)
                Print #1
            Next j
            Print #1 "Your points:" & Points
            Close #1
            ShellExecute Me.hWnd, "",  Application.Path & "\test_result,txt", "", "", 1
            Exit Sub
        Else
            For j = 1 To 4
                Me.Controls.Item(j - 1) .Text = a(i, j)
            Next j        
        End If
    End Sub
      

  2.   

    都写那么多了,再加把劲不就自己完成了?
    1、把a(9,5)扩充到a(9,6),最后一个储存用户的答案;在Button3_Click开始部分获取当前题目的答案并储存到a(i,6)里面;
    2、最后统计的时候只需要判断a(i,5)=a(i,6)?写文件的时候用fso很简单的
      

  3.   

    存储结构:
    A表,题号,题干,选项A,选项B,选项C,选项D,答案,分值
    B表,考生号,题号,答案select B表.考生号, sum(A表.分值) from B表,A 表
    where A表.题号=B表.题号 and  A表.答案=B表.答案
    group by B表.考生号随手写的,主要看思路,