VisualBasic实验指导书程序代码精.pdf

上传人:深夜****等你... 文档编号:84203279 上传时间:2023-04-04 格式:PDF 页数:7 大小:78.38KB
返回 下载 相关 举报
VisualBasic实验指导书程序代码精.pdf_第1页
第1页 / 共7页
VisualBasic实验指导书程序代码精.pdf_第2页
第2页 / 共7页
点击查看更多>>
资源描述

《VisualBasic实验指导书程序代码精.pdf》由会员分享,可在线阅读,更多相关《VisualBasic实验指导书程序代码精.pdf(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、1 2020419 VisualBasic 2 2020 4 19 9-1 Option Explicit Option Base 1 Private Sub Command1_Click(Dim x(10 As Integer,maxv As Integer,minv As Integer Dim i As Integer For i=1 To 10 x(i=Int(90*Rnd+10 Text1.Text=Text1&Str(x(i Next i Call maxmin(x,maxv,minv Text2.Text=maxv Text3.Text=minv End Sub Private

2、Sub Command2_Click(Text1.Text=3 2020 4 19 Text2.Text=Text3.Text=End Sub Private Sub Command3_Click(End End Sub Private Sub maxmin(a(As Integer,max As Integer,min As Integer Dim i As Integer max=a(1:min=a(1 For i=LBound(a+1 To UBound(a If a(i max Then max=a(i ElseIf a(i min Then min=a(i End If Next i

3、 4 2020 4 19 End Sub 9-2 Private Sub Command1_Click(Dim x As Long x=Val(Text1.Text If verify(x Then List1.AddItem x Else MsgBox Str(x&,vbInformation End If End Sub Private Sub Command2_Click(Text1.Text=End Sub Private Sub Command3_Click(End End Sub 5 2020 4 19 Private Function verify(x As Long As Bo

4、olean Dim y As Long,s As Integer verify=False s=Len(CStr(x y=x*x If x=Val(Right(CStr(y,s Then verify=True End If End Function 9-3 Option Explicit Option Base 1 Private Sub Command1_Click(Dim a As Integer,b As Integer,i As Integer a=Val(Text1.Text:b=Val(Text2.Text 6 2020 4 19 For i=a To b If sx(i=Tru

5、e Then List1.AddItem i 8 End If Next i If List1.ListCount=0 Then List1.AddItem End Sub Private Sub Command2_Click(Text1.Text=Text2.Text=List1.Clear Text1.SetFocus End Sub Private Sub Command3_Click(End End Sub 7 2020 4 19 Private Function sx(ByVal n As Integer As Boolean Dim a(As Integer,k As Integer,i As Integer Do k=k+1 ReDim Preserve a(k a(k=n Mod 10 n=n 10 Loop Until n=a(i Then Exit Function Next i

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 小学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁