当前位置:编程学习 > VB >>

求助VB编程

1.编写程序,在程序运行时输入购书数量和单价,输出需要金额,购书优惠措施如下:
数量低于50本按原价
数量在50-99本时按90%原价
数量在100-499本按80%原价
数量在500本以上(含500本)按75%原价
答案:
Dim s As Integer
Dim d As Single
Dim j As Double
Private Sub Form_Load()
s = InputBox("请输入购书数量:")
d = InputBox("请输入购书单价:")
Select Case s
Case Is < 50
j = s * d
Case 50 To 99
j = s * d * 0.9
Case 100 To 499
j = s * d * 0.8
Case Is >= 500
j = s * d * 0.75
End Select
Text1 = "需要金额:" & j
End Sub
用IF 语句判断  

上一个:VB编程问题
下一个:vb编程问题

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,