大概写一个小程序
帮个忙,这一个程序,从文件中读取10个数,写入数组中,然后找出最大数的位置,然后用选择排序发降序排列写入文件中,大概这样,用VB写,麻烦大神,万分感谢,VB没学过

解决方案 »

  1.   

    '*************************************
       Dim Data1  As Long
       dataLng = Array(3, 6, 5, 8, 7, 9, 4, 2, 1, 10)
       '此处如果有输入文件则换成打开文件,读取取到数组中即可
       
    '*************************************
       Dim i As Integer, j As Integer, tmp As Integer
       Dim N As Integer     '数据个数
       N = UBound(dataLng)
       Debug.Print Now
       For i = 0 To N
          For j = i + 1 To N
              If dataLng(i) < dataLng(j) Then   '条件成立 ,则位置交换
                  tmp = dataLng(j)
                  dataLng(j) = dataLng(i)
                  dataLng(i) = tmp
              End If
          Next j
        Next i
         
        Close #1
        Open "c:\out.txt" For Output As #1
        For i = 0 To N
              Print #1, dataLng(i)
        Next i
        Close #1