vb高手请教我啊!

来源:百度知道 编辑:UC知道 时间:2024/05/17 20:35:19
你好,我想请教您一下,我遇到这样的问题,就是下面所示的两程序,运行结果都是一样的,但是标准答案是第二种,我不知道考试的时候我用第一种我自己编的程序可以不?但是它没有错啊。不知道考试系统能否识别为正确答案。谢谢!
第一种:
Private Sub Command1_Click()
If Op1.Value = True Then
Text1.Text = "需要1小时"
ElseIf Op2.Value = True Then
Text1.Text = "需要10小时"
ElseIf Op3.Value = True Then
Text1.Text = "需要15小时"
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
Open "out4.txt" For Output As #1
Print #1, Op1.Value, Op2.Value, _
Op3.Value, Text1.Text
End Sub

第二种:
Private Sub Command1_Click()
If Op1.Value = True Then
StrTime = 1
ElseIf Op2.Value = True Then
StrTime = 10
ElseIf Op3.Value = True Then
StrTime = 15
End If
Text1.Text = "需要" & StrTime & "小时"
End Sub

Private Sub Form_Unload(Cancel As Integer)
Open "out4.txt" For Output As #1
Print #1, Op

能识别。。不管是不是人工阅卷都能识别。
系统只是把你的程序调过去后运行一下。只看结果。

我觉得这样也应该是可以的

哦,可以的,真正合格的VB程序测试系统应该明白VB里也有条条大陆通罗马的这个基本现象。