Home > Software engineering >  Novice for help, in the self-study, how to record the choice of each question and then give points,
Novice for help, in the self-study, how to record the choice of each question and then give points,

Time:10-02


When the user selects an answer and click the "next after the title" can do the next topic, as the last topic when the pop-up dialog prompting the user has finished all the exercises, the user all the answers and scores recorded and saved to a text file, the file name set, for the sake of simplicity, considering only one article, there are ten multiple-choice, each topic 10 points, the basic framework as shown in figure, and perfect... ah... TAT won't do

CodePudding user response:

Definition 2 level form array variable
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. The Item (j - 1) Value=https://bbs.csdn.net/topics/True Then
TMP=CRH (64 + j)
Choice (I)=TMP
If TMP=a (I, 5) Then Points Points + 10=
The Exit For
End the If
Next j

If j=5 Then
MsgBox (" please select the answer ")
The Exit Sub
End the If

I=I + 1
If I=10 Then
MsgBox (" you have completed all test, please check your grades and click exit ")
The Open Application. The Path & amp; "\ test_result, TXT" For the Output As the # 1
For j=0 To 9
Print # 1, a (j, 0)
Print # 1, "Answer:" & amp; A (j, 5)
Print # 1, "Your Choice:" & amp; Choice (j)
Print # 1
Next j
Print # 1 "Your points:" & amp; Points
Close # 1
ShellExecute Me. HWnd, ", "Application. The Path & amp; "\ test_result, TXT", ""," ", 1
The Exit Sub
The Else
For j=1 To 4
Me. Controls. The Item (j - 1) Text=a (I, j)
Next j
End the If
End Sub

CodePudding user response:

They are written so much, don't work harder you finish?
1, its a (9, 5) to a (9, 6), the last to store the user answer; Answer in Button3_Click beginning for current topics and stored into a (I, 6);
2, and finally statistics only need to decide a (I, 5)=a (I, 6)? When writing files using fso is very simple

CodePudding user response:

Ha ha, he just don't know how to save selection results, no matter where,

CodePudding user response:

Storage structure:
A table, qid, dry, option A and option B, option C, option D, the answer, score
Table B, examinee, qid, answer

Select table B. Candidates, sum (A table. Score) from B table, A table
Where A table. Qid=B table. Qid and A table. The answer=B table. The answer
Group by B table. The candidate number

Writing them, basically see train of thought,