- 76
- 0
- 约7.76千字
- 约 11页
- 2017-09-17 发布于江西
- 举报
VB第三章编程题答案
1.在文本框中输入小时、分、秒,将它们换算为秒,然后输出。设小时为h,分为m,秒s ,则计算共有多少秒的公式为:x=h*3600+m*60+s。Private Sub Command1_Click()
Dim h As Single, m As Single, s As Single, x As Single
h = Text1.Text
m = Text2.Text
s = Text3.Text
x = h * 3600 + m * 60 + s
Label4.Caption = 共有 x 秒
End Sub
2. 编写程序,计算分段函数的值。Private Sub Command1_Click()
Dim n As Single, y As Single
n = Text1.Text
Select Case n
Case Is 0
y = 3 * n + 2
Case 0
y = 0
Case Else
y = 2 * n - 1
End Select
Label2.Caption = y= y
End Sub
3. 计算奖金。企业利润I低于5000元的,奖金为利润的1%,当5000=I<10000,超过5000元部分奖金为1.5%;当10000=I2
原创力文档

文档评论(0)