1、医药信息技术基础实践指导答案作者晏峻峰医药信息技术基础实践指导作者:晏峻峰练习答案答案由“晓英振辉奇葩计算机”提供(红色加粗是检索词,绿色是备注)Public Class Form1Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ClickDim var1 As Integer, var2 As Stringvar1 = 12345var2 = InputBox( 输入 Var2=, 输入对话框 )MsgBox(var2 & Chr(13) + Chr(10) & v
2、ar1= & Str(var1)MsgBox(var2 & vbCrLf & var1= & Str(var1)End SubEnd Class定义不同变量Public Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickDim a As Short短型Dim b As Single单精度Dim c As Integer整型Dim d As DateDim e1 As StringDim f As Boolean
3、判断Dim g As StringDim h As Double双精度Dim i As SingleDim j(4, 3) As Integera = 3.25b = 546.2c = 5383149d = #12/31/2003#1e1 = ABCDEFf = Falseg = 123456h = 3.24E+100i = 1.2563E+15j(0, 0) = 456MsgBox(a & vbCrLf & b & vbCrLf & c & vbCrLf & d & vbCrLf & e1 & vbCrLf & f & vbCrLf&g & vbCrLf & h & vbCrLf & i &
4、 vbCrLf & j(0, 0) End Sub分析不同表达式,定义并输出结果Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickDim x21, x22, x23, x24 As SingleDim x25, x27, x28 As BooleanDim x26 As Stringx21= Sqrt(3 2 / (2 * 4)开方x22= +Abs(0.123 - 3)绝对值x23= -Sin(30)x24= Exp(6) + L
5、og(2.135)e的 6 次方x25= 89 & 12 8912x26= AB + Str(32.56) + CDx27 = Mid(student, 5) = ent And (5 2)右边数三位x27= Microsoft.VisualBasic.Right(student, 3) = ent And (5 2)x28= Not (6 2) Or (7 b Thenx = ay = bElsex = by = a8End IfIf c a Thenx = cElseIf c b Theny = cEnd IfEnd IfMsgBox(最大数 & x & 最小数 & y)End SubIf
6、 语句进行有条件的计算Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.ClickDim t As Single, f As Singlet = InputBox( 请输入 t)If t = 90 Theny = AElseIf x = 80 Theny = BElseIf x = 70 Theny = CElseIf x = 60 Theny = DElsey = EEnd If9MsgBox(成绩 & x & 等级为 & y)End Su
7、bSelect 语句进行有条件的计算Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.ClickDim x As Single, y As Singlex = InputBox( 请输入 x)Select Case xCase Is = -1y = x - 1Case Is = 2y = 2 * xCase Is = 0 Thenx1 = -b + Math.Sqrt(x) / 2 / ax2 = -b - Math.Sqrt(x) / 2
8、/ aMsgBox(x1= & Format(x1, #.#) & x2= & Format(x2, #.#)Elsex1 = Math.Sqrt(-x) / 2 / ax2 = -Math.Sqrt(-x) / 2 / aMsgBox(x1= & -b / 2 / a & x1 & i x2= & -b / 2 / a & x2 & i)End IfEnd SubPrivate Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.ClickDim x As Single, y As Single10x = InputBox( 请输入 x)If x = -1 Theny = x - 1ElseIf x = 2 Theny = 2 * xElseIf x = 10 Theny = x * (x + 2)End
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1