2005年春上机改错题01.doc

  1. 1、本文档共16页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
2005年春上机改错题01

2005年春上机改错题01 Option Explicit Private Sub Command1_Click() Dim I As Integer, S As String, Flg As Boolean For I = 2 To 10 Call Sub1(I, S, Flg) Flg = False If Flg Then Text1.Text = Text1 S vbCrLf End If Next I End Sub Private Sub Sub1(K As Integer, S As String, F As Boolean) Dim I As Integer, Sum1 As Integer, Sum2 As Integer Dim N As Integer, Start As Integer Do While Sum1 Sum2 And N 100 ‘位置错 Start = Start + 1 N = Start S = N: Sum1 = N For I = 1 To K - 1 N = N + 1 Sum1 = Sum1 + N S = S + N Next I S = S = N N = N + 1 Sum2 = N For I = 1 To K - 2 N = N + 1 Sum2 = Sum2 + N S = S + N Next I N = N + 1 If Sum1 = Sum2 Then F = True End If Loop End Sub 2005年春上机编程题01 Option Explicit Option Base 1 Private Sub Command1_Click() Dim i As Integer, a() As Integer, n As Integer Dim d(20) As Long, k As Integer, j As Integer, sd As Long Dim hang As Integer, f As Boolean n = Val(Text2) Randomize ReDim a(n) hang = 1 For i = 1 To 20 Do Do a(1) = Int(9 * Rnd) Loop While a(1) = 0 For k = 2 To n a(k) = Int(9 * Rnd) Next k sd = sum(a, n) For j = 1 To i If sd = d(j) Then Exit For Next j Loop While j i If hang Mod 5 = 0 Then Text1.Text = Text1.Text Str(sd) vbCrLf hang = 1 Else Text1.Text = Text1.Text Str(sd) hang = hang + 1 End If d(i) = sd f = True For j = 1 To n - 1 If a(j) = a(j + 1) Then f = False Next j If f = True Then List1.AddItem sd Next i End Sub Public Function sum(b() As Integer, m As Integer) As String

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档