'提供给考生的程序 Private Sub Form_Unload(Cancel As Integer) Open App.Path & "\out4.txt" For Output As #1 Print #1, Op1.Value, Op2.Value, Op3.Value, Text1.Text End Sub
查看答案
'需要考生编写的程序 Private Sub C1_Click() If Op1.Value Then Text1.Text = "需要1小时" ElseIf Op2.Value Then Text1.Text = "需要10小时" ElseIf Op3.Value Then Text1.Text = "需要15小时" End If End Sub
Dim a(100) As Integer Private Sub Command1_Click() Dim k As Integer Open App.Path & "\in5.dat" For Input As #1 For k = 1 To 100 Input #1, a(k) Next k Close #1 End Sub
查看答案
Private Sub Command2_Click() '考生应完成的程序 Dim s As Long, n As Integer For i = 1 To 100 If isnarc(a(i)) Then s = s + a(i) n = n + 1 End If Next i Text1.Text = Fix(s / n) End Sub Function isnarc(p As Integer) x = Fix(p / 100) y = Fix((p - x * 100) / 10) z = p - x * 100 - y * 10 If p = x ^ 3 + y ^ 3 + z ^ 3 Then isnarc = True Else isnarc = False End If End Function Private Sub Form_Unload(Cancel As Integer) Open App.Path & "\out5.dat" For Output As #1 Print #1, Text1.Text Close #1 End Sub
Private Sub C1_Click() If Op1 And Op3 Then Text1.Text = "坐飞机去广州" ElseIf Op1 And Op4 Then Text1.Text = "坐飞机去昆明" ElseIf Op2 And Op3 Then Text1.Text = "坐火车去广州" ElseIf Op2 And Op4 Then Text1.Text = "坐火车去昆明" End If End Sub Private Sub Form_Unload(Cancel As Integer) Open App.Path & "\out3.txt" For Output As #1 Print #1, Op1.Value, Op2.Value, Op3.Value, Op4.Value, Text1.Text Close #1 End Sub
Private Sub Op1_Click() a$ = Text1.Text Text1.Text = Text2.Text Text2.Text = a$ Op1.Visible = False End Sub
查看答案
Private Sub Form_Unload(Cancel As Integer) Open App.Path & "\out4.txt" For Output As #1 Print #1, Text1.Text, Text2.Text, Text3.Text Close #1 End Sub Private Sub Op2_Click() Text3.Text = Text1.Text & Text2.Text End Sub
' 提供给考生的程序 Option Base 1 Dim Arr1(20) As Integer Dim Arr2(20) As Integer ' 提供给考生的程序 Sub ReadData1() Open App.Path & "\" & "datain1.txt" For Input As #1 For i = 1 To 20 Input #1, Arr1(i) Next i Close #1 End Sub ' 提供给考生的程序 Sub ReadData2() Open App.Path & "\" & "datain2.txt" For Input As #1 For i = 1 To 20 Input #1, Arr2(i) Next i Close #1 End Sub ' 提供给考生的程序 Sub WriteData(Filename As String, Num As Integer) Open App.Path & "\" & Filename For Output As #1 Print #1, Num Close #1 End Sub
查看答案
' 要求考生编写的程序 Dim Sum As Integer ' 要求考生编写的程序 Private Sub C1_Click() ReadData1 ReadData2 End Sub ' 要求考生编写的程序 Private Sub C2_Click() Dim Arr3(20) As Integer Sum = 0 For i = 1 To 20 Arr3(i) = Arr1(i) + Arr2(i) Sum = Sum + Arr3(i) Next i Print "Sum = "; Sum End Sub ' 要求考生编写的程序 Private Sub C3_Click() WriteData "DataOut.txt", Sum End Sub