用if语句的嵌套实现多重选择结构
书城的促销活动方案进行了修改,购书未满200元的,赠送5元购书券;购书满200元但未满500元。赠送购书券为消费金额的5%:购书满500元但未满1000元,赠送购书券金额为消费金额的10%;购书满1000元,赠送购书券金额为消费金额的15%。购书券最小面值1元。
Private Sub Command1_Click()
Dim m As Single
Dim p As Single
m = Val(Text1.Text)
If m < 200 Then
p = 5
Else
If m < 500 Then
p = m * 0.05
Else
If m < 1000 Then
p = m * 0.1
Else
p = m * 0.15
End If
End If
End If
Text2.Text = p
End Sub
本文来源:https://www.2haoxitong.net/k/doc/b7ca081e640e52ea551810a6f524ccbff121cada.html
文档为doc格式