1.某数组有20个元素,其值为随机产生的两位整数。现要求将.doc

1.某数组有20个元素,其值为随机产生的两位整数。现要求将.doc

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

1.某数组有20个元素,其值为随机产生的两位整数。现要求将前10个元素与后10个元素对换。即第1个元素与第20个元素互换,第2个数与第19个元素互换,…,第10个元素与第11个元素互换。在窗体上输出数组原来各元素的值与对换后各元素的值。  Option Explicit  Dim a(1 To 20) As Integer, i As Integer, j As Integer, t As Integer    Private Sub Form_Load()  Show  Print   Randomize    For i = 1 To 20  a(i) = Int(Rnd * 90) + 10  Print a(i);    If i Mod 10 = 0 Then Print  Next i  Print    Print   For i = 1 To 10   j = 21 - i   t = a(i): a(i) = a(j): a(j) = t   Next i  For i = 1 To 20  Print a(i);  If i Mod 10 = 0 Then Print        Option Explicit  Dim a() As Integer, i As Integer, j As Integer, n As Integer, k As Integer, m As Integer   Dim flag As Boolean  Private Sub Form_Load()   Show  ReDim a(9) As Integer   m = 1    Print   For i = 0 To 9  a(i) = InputBox( m 个数:)   Print a(i);    m = m + 1    Next i    Print   n = InputBox()  i = 0: flag = False  Do  If a(i) = n Then   j = i: flag = True  For k = j To UBound(a) - 1   a(k) = a(k + 1)   Next k   ReDim Preserve a(UBound(a) - 1)   i = i - 1    End If    i = i + 1    Loop While (i = UBound(a))    If flag = False Then  MsgBox n   Else   Print n 后的数组是:    For i = 0 To UBound(a)    Print a(i);  Next i  End If          Option Explicit: Option Base 1   Dim a(), n As Integer, i As Integer, m As Integer, k As Integer   Private Sub Form_Load()   Show  n = 8: ReDim a(n)   a = Array(5, 15, 23, 52, 68, 88, 90, 99)   For i = 1 To 8    Print a(i);    Next  Print  n = n + 1: ReDim Preserve a(n)    For i = 1 To n - 1   If m a(i) Then Exit For   Next i   For k = n To i + 1 Step -1    a(k) = a(k - 1)  Next k  a(k) = m   For i = 1 To n    Print a(i);  Next i    Print   End Sub                                               Option Explicit      Private Sub Command1_Click()    Dim a As Long, b As Long, c As Long, m As Double, x As Single, y As Single, d As Single, e As Single, xu1 As String, xu2 As String  a = Val(Text1.Text): b = Val(Text2.Text): c = Val(Text3.Text)   m = b ^ 2 - 4 * a * c  S

文档评论(0)

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

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

1亿VIP精品文档

相关文档