- 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
您可能关注的文档
- 带档滑行好处.doc
- 带然四字词.doc
- 山东省临清实验高中物理 第六章第3节传感器应用(二)学案 新人教版选修3-2.doc
- 带电粒子在匀强电场中运动(曾星亮).doc
- 带电容滤波三相不控整流桥仿真.doc
- 带电粒子在复合场中运动轨迹讨论.doc
- 带移位运算实验计算机组成和程序运行实验.doc
- 带自锁装置气动升降杆.doc
- 常州市默顿电气无功补偿控制器特点.doc
- 常用77种溶剂理化性质简.doc
- 2026年及未来5年内中国液体氩气行业投资前景及策略咨询研究报告.docx
- 2026年及未来5年内中国黄铜合页行业投资前景及策略咨询研究报告.docx
- 2026年及未来5年内中国竹工艺家具行业投资前景及策略咨询研究报告.docx
- 2025年中国微机数显自动分析仪市场调查研究报告.docx
- 2026年及未来5年内中国微尘白色粉笔行业投资前景及策略咨询研究报告.docx
- 2025年中国微电脑型压胶机市场调查研究报告.docx
- 2026年及未来5年内中国数字化等功游泳训练测试系统行业投资前景及策略咨询研究报告.docx
- 2025年中国圆形花瓶市场调查研究报告.docx
- 2026年及未来5年内中国植物纤维静淀过滤器行业投资前景及策略咨询研究报告.docx
- 2025年中国超音波手套机市场调查研究报告.docx
原创力文档

文档评论(0)