成绩生成和排序vb编程.docVIP

  • 40
  • 0
  • 约2.86万字
  • 约 3页
  • 2017-08-06 发布于河南
  • 举报
成绩生成和排序vb编程

Dim a() As String, b() As String, c() As String, n As Integer Private Sub Command1_Click() Cls s = 0: n = 0 Dim i As Integer Open App.Path \模拟成绩.txt For Input As #1 Do While EOF(1) = False Input #1, x, y, z s = s + z n = n + 1 Loop ave = s / n Close #1 Print 平均成绩= Int(ave * 10) / 10 End Sub Private Sub Command2_Click() Cls Open App.Path \模拟成绩.txt For Input As #2 Do While EOF(2) = False Input #2, g, h, d If d = 90 Then x = x + 1 End If If d = 80 And d 90 Then y = y + 1 End If If d = 70 And d 80 Then z = z + 1 End If If d = 60 And d 70 Then w = w + 1 End If If d 60 Then v = v + 1 End If Loop Print 优秀人数为: x Print 良好人数为: y Print 中等人数为: z Print 合格人数为: w Print 不合格人数为: v End Sub Private Sub Command3_Click() Cls Print 补考名单为: Open App.Path \模拟成绩.txt For Input As #3 Do While EOF(3) = False Input #3, g, h, d If d 60 Then Print h ; 成绩: d End If Loop End Sub Private Sub Command4_Click() Dim max As String For hh = 1 To n For h = 1 To n - 1 If c(h) c(h + 1) Then max = c(h + 1): c(h + 1) = c(h) c(h) = max max = a(h + 1): a(h + 1) = a(h) a(h) = max max = b(h + 1): b(h + 1) = b(h) b(h) = max End If Next h Next hh Open App.Path \排序.txt For Output As #5 For e = n To 1 Step -1 Write #5, a(e), b(e), c(e) Next e Close #5 MsgBox 排序结束,请打开文件夹查看排序.text文件中的数据 End Sub Private Sub Form_Load() Open App.Path \模拟成绩.txt For Input As #4 n = 0 Do While EOF(4) = False n = n + 1 ReDim Preserve a(n), b(n), c(n) Input #4, a(n), b(n), c(n) Loop End Sub

文档评论(0)

1亿VIP精品文档

相关文档