经典VB题.docVIP

  • 24
  • 0
  • 约8.36千字
  • 约 11页
  • 2018-02-08 发布于河南
  • 举报
实验一:判断输入的整数是否是偶数 Private Sub Command1_Click() Dim n As Integer n = Text1 If n Mod 2 = 0 Then MsgBox n 是偶数 Else MsgBox n 是奇数 End If End Sub 实验二:将百分制转换为5级分制 Private Sub Command1_Click() Dim x As Integer, y As Integer x = Text1 If 0 = x x = 60 Then y = 2 ElseIf x 70 Then y = 3 ElseIf x 90 Then y = 4 Else y = 5 End If Text2 = Str(y) End Sub Private Sub Command2_Click() Text1.Text = Text2.Text = Text1.SetFocus End Sub 实验三:计算多表达式函数值 Private Sub Command1_Click() Dim x As Single, y As Single, z As Single x = Text1: z = Text2 If z 0 Then If x -10 Then y = x ^ 2 + z ^ 2 Else y = x + z End If El

文档评论(0)

1亿VIP精品文档

相关文档