用VB编制程序,计算某个学生奖学金的等级,以三门课程成绩为评奖依据

用VB编制程序,计算某个学生奖学金的等级,以三门课程成绩为评奖依据,第1张

Dim m1%, m2%, m3%, a As String, b As String

Private Sub Form_click()

m1 = InputBox("请输入第一门成绩")

m2 = InputBox("请输入第二门成绩")

m3 = InputBox("请输入第三门成绩")

a = (m1 = 100 And m2 = 100) Or (m1 = 100 And m3 = 100) Or (m2 = 100 And m3 = 100)

b = m1 = 100 Or m2 = 100 Or m3 = 100

x = 95: y = 90: z = 70

If (Val(m1) + Val(m2) + Val(m3)) / 3 >95 And a Then

Print "该生有评选一等见的资格"

ElseIf (Val(m1) + Val(m2) + Val(m3)) / 3 >90 And b Then

Print "该生有评选一等见的资格"

ElseIf 70 <= (Val(m1) + Val(m2) + Val(m3)) / 3 Then

Print "该生有评选一等见的资格"

Else

Print "该生无评选资格"

End If

End Sub

'需要控件:command1

Private Sub Command1_Click()

Dim Sum As Long

For i = 0 To 9999

DoEvents

For j = 1 To Len(i)

Select Case UBound(Split(Str(i), Mid(Str(i), j, 1)))

Case 2: Sum = Sum + 10

Case 3: Sum = Sum + 100

Case 4: Sum = Sum + 1000

Case Else

End Select

Me.Caption = Sum

Next j

Next i

' 结果为:170640 此结果,,不考虑,相同的是否不相领 如 3313此号,也为中了100元

Me.Caption = Sum

End Sub


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12062011.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存