资源描述:
《《医药信息技术基础实践指导》答案作者晏峻峰.docx》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、《医药信息技术基础实践指导》作者:晏峻峰练习答案答案由“晓英振辉奇葩计算机”提供(红色加粗是检索词,绿色是备注)PublicClassForm1PrivateSubForm1_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesMe.ClickDimvar1AsInteger,var2AsStringvar1=12345var2=InputBox("输入Var2=","输入对话框")MsgBox(var2&Chr(13)+Chr(10)&"va
2、r1="&Str(var1))'MsgBox(var2&vbCrLf&"var1="&Str(var1))EndSubEndClass定义不同变量PublicClassForm1PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimaAsShort‘短型DimbAsSingle‘单精度DimcAsInteger‘整型DimdAsDateDime1AsStringDi
3、mfAsBoolean‘判断DimgAsStringDimhAsDouble‘双精度DimiAsSingleDimj(4,3)AsIntegera=3.25b=546.2c=5383149d=#12/31/2003#e1="ABCDEF"f=Falseg="123456"h=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&vbCrL
4、f&j(0,0))EndSub分析不同表达式,定义并输出结果PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimx21,x22,x23,x24AsSingleDimx25,x27,x28AsBooleanDimx26AsStringx21=Sqrt(3^2/(24))‘开方x22=+Abs(0.123-3)‘绝对值x23=-Sin(30)x24=Exp(6)+Lo
5、g(2.135)‘e的6次方x25=89&12<>8912x26="AB"+Str(32.56)+"CD"'x27=Mid("student",5)="ent"And(5>2)‘右边数三位x27=Microsoft.VisualBasic.Right("student",3)="ent"And(5>2)x28=Not(6>2)Or(7<9)MsgBox(x21&vbCrLf&x22&vbCrLf&x23&vbCrLf&x24&vbCrLf&x25&vbCrLf&x26&vbCrLf&x27&vbCrLf&x
6、28)EndSub一百以内随机数PrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickDimyAsIntegery=Int(Rnd()100)MsgBox(y)EndSub任意字符串测长度PrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.Cl
7、ickDimyAsStringDimy1AsIntegery="VB程序设计语言"y1=Len(y)MsgBox(y&"长度为"&y1)EndSub给出字符串查片段位置PrivateSubButton5_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton5.ClickDimyAsIntegery=InStr("abcstudent","stu")MsgBox(y)EndSub除去字符串两边空格PrivateSubBu
8、tton6_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton6.ClickDimyAsStringy=Trim("VisualC++")MsgBox("去除左边空格"&y&"去除右边空格")EndSub测字符串所占字节数PrivateSubButton7_Click(ByValsenderAsSystem.Object,