欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    江苏省高等院校计算机等级考试vb书后习题答案 .pdf

    • 资源ID:33926157       资源大小:586.96KB        全文页数:17页
    • 资源格式: PDF        下载积分:4.3金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要4.3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    江苏省高等院校计算机等级考试vb书后习题答案 .pdf

    第 6 章 数组习题参考答案6-1 请同学上机运行代码。6-2 Option Explicit Option Base 1 Private Sub Command1_Click() Dim i As Integer, t As Integer Dim a(15) As Integer Randomize For i = 1 To 15 a(i) = Int(100 * Rnd) Text1 = Text1 & Str(a(i) Next i For i = 1 To 7 t = a(i) a(i) = a(16 - i) a(16 - i) = t Next i For i = 1 To 15 Text2 = Text2 & Str(a(i) Next i End Sub Private Sub Command2_Click() Text1 = Text2 = End Sub Private Sub Command3_Click() End End Sub 6-3 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 17 页 - - - - - - - - - Option Explicit Dim a(20) As Integer Private Sub Command1_Click() Dim i As Integer Randomize For i = 1 To 20 a(i) = Int(90 * Rnd) + 10 Text1 = Text1 & Str(a(i) Next i End Sub Private Sub Command2_Click() Dim i As Integer, j As Integer, f As Boolean Dim n As Integer For i = 1 To 20 f = True For j = i + 1 To 20 If a(i) = a(j) Then f = False Next j If f = True Then n = n + 1 Next i Text2 = n End Sub Private Sub Command3_Click() Text1 = End Sub Private Sub Command4_Click() End End Sub 6-4 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 17 页 - - - - - - - - - Option Explicit Dim a(20) As Integer Private Sub Command1_Click() Dim i As Integer Randomize For i = 1 To 20 a(i) = Int(90 * Rnd) + 10 Text1 = Text1 & Str(a(i) Next i End Sub Private Sub Command2_Click() Dim i As Integer, j As Integer, max As Integer Dim n As Integer, w As Integer, p As Integer For i = 1 To 20 n = 0: p = i For j = 1 To 4 If i 20 Then p = p - 20 n = n + a(p) Next j If n max Then max = n w = i End If Next i Text2 = max Picture1.Print w & - & w + 4 End Sub Private Sub Command3_Click() Text1 = End Sub Private Sub Command4_Click() End End Sub 6-5 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 17 页 - - - - - - - - - Dim a(5, 5) As Integer Private Sub Command1_Click() For i = 1 To 4 For j = 1 To 5 a(i, j) = Int(9 * Rnd) + 1 Picture1.Print a(i, j); Next j Picture1.Print Next i End Sub Private Sub Command2_Click() For j = 1 To 5 s = 0 For i = 1 To 4 s = s + a(i, j) Next i Text1 = Text1 & Str(s) Next j End Sub Private Sub Command3_Click() For i = 1 To 4 s = 0 For j = 1 To 5 s = s + a(i, j) Next j Text2 = Text2 & Str(s) & Chr(13) & Chr(10) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 17 页 - - - - - - - - - Next i End Sub Private Sub Command4_Click() Text1 = Text2 = Picture1.Cls End Sub Private Sub Command5_Click() End End Sub 6-6 Option Explicit Private Sub Command1_Click() Dim a(5, 5), i As Integer, j As Integer Dim n As Integer, m As Integer, t As Integer Randomize For i = 1 To 5 For j = 1 To 5 - 1 a(i, j) = Int(40 * Rnd) * 2 + 10 Next j Next i For i = 1 To 5 For j = 5 To 6 - i Step -1 a(i, j) = Int(40 * Rnd) * 2 + 11 Next j Next i For i = 1 To 5 For j = 1 To 5 Text1 = Text1 & Str(a(i, j) Next j Text1 = Text1 & vbCrLf 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 17 页 - - - - - - - - - Next i End Sub 6-7 同 6-4 6-8 Dim a(5, 5) As Integer Private Sub Command1_Click() Randomize For i = 1 To 5 For j = 1 To 5 a(i, j) = Int(100 * Rnd) + 1 Picture1.Print Right( & a(i, j), 4); Next j Picture1.Print Next i End Sub Private Sub Command2_Click() For i = 1 To 5 For j = 1 To 5 s = s + a(i, j) Next j Next i Text1 = Str(s) End Sub Private Sub Command3_Click() For i = 1 To 5 For j = 1 To 5 If i = 1 Or j = 1 Or i = 5 Or j = 5 Then 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 17 页 - - - - - - - - - s = s + a(i, j) End If Next j Next i Text2 = Str(s) End Sub Private Sub Command4_Click() For i = 1 To 5 For j = 1 To 5 If i = j Or j = 6 - i Then s = s + a(i, j) End If Next j Next i Text3 = Str(s) End Sub 6-9 Option Explicit Private Sub Command1_Click() Dim a() As Integer, i As Integer, j As Integer Dim max As Integer, k As Integer, f As Boolean Dim n As Integer, m As Integer, t As Integer n = InputBox( 输入矩阵的行数:) m = InputBox( 输入矩阵的列数:) ReDim a(n, m) Randomize For i = 1 To n For j = 1 To m a(i, j) = Int(90 * Rnd) + 10 Text1 = Text1 & Str(a(i, j) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 17 页 - - - - - - - - - Next j Text1 = Text1 & vbCrLf Next i For i = 1 To n max = 0 For j = 1 To m If a(i, j) max Then max = a(i, j) t = j End If Next j For k = 1 To n If a(k, t) n Then Picture1.Print 鞍点: ; a(i, t); 第; i; 行; t; 列 f = True End If Next i If f = False Then Picture1.Print 没有鞍点 End Sub Private Sub Command2_Click() Text1 = Picture1.Cls End Sub Private Sub Command3_Click() End End Sub 6-10 Option Explicit 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 17 页 - - - - - - - - - Private Sub Form_Click() Dim a() As Integer, n As Integer Dim i As Integer, j As Integer n = InputBox( 层数 ) ReDim a(n, n) For i = 1 To n Print Tab(20 - 2 * i); For j = 1 To i If i = 1 Or i = j Then a(i, j) = 1 Else a(i, j) = a(i - 1, j - 1) + a(i - 1, j) End If Print Left(a(i, j) & , 4); Next j Print Next i End Sub 6-11 Option Explicit Private Sub Command1_Click() Dim a(4, 5), i As Integer, j As Integer Dim b(4) As Integer, max As Integer, min As Integer Dim n As Integer, m As Integer, t As Integer Randomize max = 0: min = 32767 For i = 1 To 4 For j = 1 To 5 a(i, j) = Int(90 * Rnd) + 10 Text1 = Text1 & Str(a(i, j) b(i) = b(i) + a(i, j) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 17 页 - - - - - - - - - Next j Text1 = Text1 & vbCrLf If max b(i) Then min = b(i): n = i End If Next i Label1.Caption = max 行和: & max & min行和: & min & vbCrLf & max行: & m & min 行: & n & 交换这两行 For j = 1 To 5 t = a(m, j) a(m, j) = a(n, j) a(n, j) = t Next j For i = 1 To 4 For j = 1 To 5 Text2 = Text2 & Str(a(i, j) Next j Text2 = Text2 & vbCrLf Next i End Sub 6-12 Option Explicit Private Sub Command1_Click() Dim a(), i As Integer, j As Integer Dim b(4) As Integer, max As Integer, min As Integer Dim n As Integer, m As Integer, t As Integer Randomize n = InputBox( 矩阵阶数 n:) ReDim a(n, n) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 10 页,共 17 页 - - - - - - - - - For i = 1 To n For j = 1 To n a(i, j) = Int(90 * Rnd) + 10 Text1 = Text1 & Str(a(i, j) Next j Text1 = Text1 & vbCrLf Next i For i = 1 To n For j = 1 To n Text2 = Text2 & Str(a(j, i) Next j Text2 = Text2 & vbCrLf Next i End Sub Private Sub Command2_Click() Text1 = Text2 = End Sub Private Sub Command3_Click() End End Sub 6-13 Option Explicit Option Base 1 Private Sub Command1_Click() Dim a(3, 3) As Integer, i As Integer, j As Integer Dim max As Long, k As Long, f As Integer Dim n As Integer, m As Integer Randomize For i = 1 To 3 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 11 页,共 17 页 - - - - - - - - - For j = 1 To 3 a(i, j) = Int(90 * Rnd) + 10 Text1 = Text1 & Str(a(i, j) Next j Text1 = Text1 & vbCrLf Next i For i = 1 To 3 主对角线方向m = i k = 1 For j = 1 To 3 k = k * a(m, j) m = m + 1 If m 3 Then m = 1 Next j If k max Then max = k n = i f = 1 End If Next i For i = 1 To 3 辅对角线方向m = i k = 1 For j = 1 To 3 k = k * a(j, m) m = m - 1 If m max Then max = k n = i f = 2 End If Next i Picture1.Print 最大组元素: If f = 1 Then For i = 1 To 2 Picture1.Print a(; n; ,; i; )=; a(n, i); ; n = n + 1 If n 3 Then n = 1 Next i Picture1.Print a(; n; ,; i; )=; a(n, i) ElseIf f = 2 Then For i = 1 To 2 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 12 页,共 17 页 - - - - - - - - - Picture1.Print a(; i; ,; n; )=; a(i, n); ; n = n - 1 If n 1 Then n = 3 Next i Picture1.Print a(; i; ,; n; )=; a(i, n) End If Picture1.Print 乘积 =; max End Sub Private Sub Command2_Click() Text1 = Picture1.Cls End Sub Private Sub Command3_Click() End End Sub 6-13(2) Option Base 1 Option Explicit Private Sub Form_Click() Dim a(3, 3) As Integer, i As Integer, m As Single Dim j As Integer, k As Integer, max As Single Dim ci As Integer, cj As Integer, ck As Integer Print 生成的二维数组: Randomize For i = 1 To 3 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 13 页,共 17 页 - - - - - - - - - For j = 1 To 3 a(i, j) = Int(Rnd * 9) + 1 Print a(i, j); Next j Print Next i Print 不同行不同列的三个数的乘积是: max = a(1, 1) * a(2, 2) * a(3, 3) ci = 1: cj = 2: ck = 3 Randomize For i = 1 To 3 For j = 1 To 3 For k = 1 To 3 If i j And j k And i k Then m = a(1, i) * a(2, j) * a(3, k) Print m; If m max Then max = m ci = i cj = j ck = k End If End If Next k Next j Next i Print Print 最大值为: & Str(max) Print A(1, & CStr(ci) & )= & Str(a(1, ci) Print A(2, & CStr(cj) & )= & Str(a(2, cj) Print A(3, & CStr(ck) & )= & Str(a(3, ck) End Sub 6-14 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 14 页,共 17 页 - - - - - - - - - Option Explicit Private Sub Command1_Click() Dim a(3, 3) As Integer, i As Integer, j As Integer Dim k As Integer i = 3: j = 2: a(i, j) = 1: k = 1 Do Until k 9 k = k + 1 If i + 1 3 And j + 1 = 3 Then i = 1: j = j + 1 ElseIf i + 1 3 Then i = i + 1: j = 1 ElseIf i + 1 3 And j + 1 3 Then i = i - 1 ElseIf i + 1 = 3 And j + 1 = 3 And a(i + 1, j + 1) 0 Then i = i - 1 Else i = i + 1: j = j + 1 End If a(i, j) = k Loop For i = 1 To 3 For j = 1 To 3 Picture1.Print a(i, j); Next j Picture1.Print Next i End Sub 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 15 页,共 17 页 - - - - - - - - - Private Sub Command2_Click() Dim a() As Integer, i As Integer, j As Integer Dim k As Integer Dim n As Integer n = InputBox( 幻方阶数: ) ReDim a(n, n) i = n: j = (n + 1) / 2: a(i, j) = 1: k = 1 Do Until k n * n k = k + 1 If i + 1 n And j + 1 = n Then i = 1: j = j + 1 ElseIf i + 1 n Then i = i + 1: j = 1 ElseIf i + 1 n And j + 1 n Then i = i - 1 ElseIf i + 1 = n And j + 1 = n And a(i + 1, j + 1) 0 Then i = i - 1 Else i = i + 1: j = j + 1 End If a(i, j) = k Loop For i = 1 To n For j = 1 To n Picture1.Print Right( & a(i, j), 4); Next j Picture1.Print Next i End Sub 6-15 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 16 页,共 17 页 - - - - - - - - - Option Explicit Option Base 1 Private Sub Command1_Click() Dim a() As Integer, i As Integer, j As Integer Dim max As Long, k As Long, f As Integer Dim n As Integer, m As Integer Randomize f = InputBox( 输入方阵阶数:) ReDim a(f, f) For i = 1 To f For j = 1 To f a(i, j) = Int(90 * Rnd) + 10 Text1 = Text1 & Str(a(i, j) Next j Text1 = Text1 & vbCrLf Next i For i = 1 To f 副对角线方向m = i k = 0 For j = 1 To f k = k + a(j, m) m = m - 1 If m max Then max = k n = i End If Next i Picture1.Print max :; max For i = 1 To f Picture1.Print a(; i; ,; n; )=; a(i, n) n = n - 1 If n 1 Then n = f Next i End Sub Private Sub Command2_Click() Text1 = Picture1.Cls End Sub Private Sub Command3_Click() End End Sub 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 17 页,共 17 页 - - - - - - - - -

    注意事项

    本文(江苏省高等院校计算机等级考试vb书后习题答案 .pdf)为本站会员(Che****ry)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

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

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

    收起
    展开