vb中,对测试分数进行统计分析,用文本框输入后分数后,再按一次命令按钮,重复输入,怎样设计程序?
PrivateSubCommand1_Click()DimintCj(1To10)AsIntegerDimintEAsInteger'<60DimintDAsIntege...
Private Sub Command1_Click()
Dim intCj(1 To 10) As IntegerDim intE As Integer '<60Dim intD As Integer '60-69Dim intC As Integer '70-79Dim intB As Integer '80-89Dim intA As Integer '90-99Dim intH As Integer '100Dim intTemp As IntegerDim i As Integeri = 1Do While i <= 10intTemp = InputBox("Please Input No." & i & "Code!")If intTemp < 0 Or intTemp > 100 ThenMsgBox ("输入错误! 请重新输入!")ElseintCj(i) = intTempi = i + 1End IfLoop
For i = 1 To 10Select Case intCj(i)Case Is <= 59intE = intE + 1Case 60 To 69intD = intD + 1Case 70 To 79intC = intC + 1Case 80 To 89intB = intB + 1Case 90 To 99intA = intA + 1Case 100intH = intH + 1End SelectNext i
Text2.Text = "100分: " & intH & "人"Text3.Text = "90-99分: " & intA & "人"Text4.Text = "80-89分: " & intB & "人"Text5.Text = "70-79分: " & intC & "人"Text6.Text = "60-69分: " & intD & "人"Text7.Text = "<60分:" & intE & "人"End Sub
以上用的是InputBox输入数组,我想用用一个文本框每次输入一个分数后,再按一下按钮的方法,得到各分数段的人数,程序代码怎么写? 展开
Dim intCj(1 To 10) As IntegerDim intE As Integer '<60Dim intD As Integer '60-69Dim intC As Integer '70-79Dim intB As Integer '80-89Dim intA As Integer '90-99Dim intH As Integer '100Dim intTemp As IntegerDim i As Integeri = 1Do While i <= 10intTemp = InputBox("Please Input No." & i & "Code!")If intTemp < 0 Or intTemp > 100 ThenMsgBox ("输入错误! 请重新输入!")ElseintCj(i) = intTempi = i + 1End IfLoop
For i = 1 To 10Select Case intCj(i)Case Is <= 59intE = intE + 1Case 60 To 69intD = intD + 1Case 70 To 79intC = intC + 1Case 80 To 89intB = intB + 1Case 90 To 99intA = intA + 1Case 100intH = intH + 1End SelectNext i
Text2.Text = "100分: " & intH & "人"Text3.Text = "90-99分: " & intA & "人"Text4.Text = "80-89分: " & intB & "人"Text5.Text = "70-79分: " & intC & "人"Text6.Text = "60-69分: " & intD & "人"Text7.Text = "<60分:" & intE & "人"End Sub
以上用的是InputBox输入数组,我想用用一个文本框每次输入一个分数后,再按一下按钮的方法,得到各分数段的人数,程序代码怎么写? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询