当前位置:首页 » 考试成绩 » 随机产生20个学生的成绩

随机产生20个学生的成绩

发布时间: 2020-12-04 03:23:18

『壹』 随机产生20个学生的成绩(整数),统计各分数段人数。即0~59、60~69、70~79、80~89、90~100,

Dim sj(19), i As Integer
Private Sub command1_Click()
Dim sj(19), i As Integer
For i = 0 To 19
sj(i) = Int(Rnd * 101)
Picture1.Print sj(i);
If (i + 1) Mod 4 = 0 Then Picture1.Print
Next i
End Sub
Private Sub Command2_Click()
Dim a, b, c, d, e As Integer, s(9), sj(19), i As Integer
For i = 0 To 19
sj(i) = Int(Rnd * 101)
Picture1.Print "";
If (i + 1) Mod 4 = 0 Then Print ""
Next i
a = 0
b = 0
c = 0
d = 0
e = 0
For i = 0 To 19
If sj(i) <= 59 Then a = a + 1
Next i
For i = 0 To 19
If sj(i) >= 60 And sj(i) <= 69 Then b = b + 1
Next i
For i = 0 To 19
If sj(i) >= 70 And sj(i) <= 79 Then c = c + 1
Next i
For i = 0 To 19
If sj(i) >= 80 And sj(i) <= 89 Then d = d + 1
Next i
For i = 0 To 19
If sj(i) >= 90 And sj(i) <= 100 Then e = e + 1
Next i
Picture2.Print "s(5)"; a; Chr(13);
Picture2.Print "s(6); b; ; Chr(13);
Picture2.Print "s(7); c; "??"; Chr(13); "s(8)"; d; ; Chr(13); "s(9)"; e;
End Sub

『贰』 [vb]随机产生20个学生的成绩,统计各分数段人数。

Option Explicit
Dim d(1 To 20) As Integer
Private Sub Command1_Click()
Dim i As Integer
Picture1.Cls
For i = 1 To 20
d(i) = Int(Rnd() * 100) + 1
Picture1.Print Format(d(i), " 0");
If i Mod 4 = 0 Then Picture1.Print
Next i

End Sub

Private Sub Command2_Click()
Dim b(5) As Integer
Dim i As Integer
Picture2.Cls
For i = 1 To 20
Select Case d(i)
Case 0 To 59
b(1) = b(1) + 1
Case 60 To 69
b(2) = b(2) + 1
Case 70 To 79
b(3) = b(3) + 1
Case 80 To 89
b(4) = b(4) + 1
Case 90 To 100
b(5) = b(5) + 1
End Select
Next
Picture2.Print "0~59:"; b(1); "个"
Picture2.Print "60~79:"; b(2); "个"
Picture2.Print "70~89:"; b(3); "个"
Picture2.Print "80~99:"; b(4); "个"
Picture2.Print "90~100:"; b(5); "个"

End Sub

Private Sub Form_Load()
Command1.Caption = "产生并显示数据"
Command2.Caption = "统计分数段人数"
End Sub

『叁』 foxpro程序 随机产生20个学生成绩,求出他们的平均成绩,并统计出高于平均成绩的学生数

clear
n=20
dimes(n)
fori=1ton
s(i)=int(rand()*100)+1
endfor

fori=1ton
?s(i)
endfor

x=0
fori=1ton
x=x+s(i)
endfor
y=int(x/n)
?'平均成绩=',y

m=0
fori=1ton
ifs(i)>y
m=m+1
endif
endfor
?'高于平均成绩人版数权=',m

fori=1ton-1
forj=1ton-i
ifs(j)>s(j+1)
t=s(j)
s(j)=s(j+1)
s(j+1)=t
endif
endfor
endfor

fori=1ton
?s(i)
endfor

return

『肆』 vb编程:随机产生20个学生课程分数并显示,统计各分数段人数,显示统计结果

Private Sub Command1_Click()
Dim a(0 To 4) As Integer, i As Integer, iScore As Integer
Randomize
For i = 1 To 20
iScore = Rnd * 100
If i Mod 4 = 0 Then Print '每4个一行
Print "学生 " & i & " 成绩: " & iScore,

If iScore >= 90 Then
a(4) = a(4) + 1
ElseIf iScore >= 80 Then
a(3) = a(3) + 1
ElseIf iScore >= 70 Then
a(2) = a(2) + 1
ElseIf iScore >= 60 Then
a(1) = a(1) + 1
Else
a(0) = a(0) + 1
End If
Next i

Print '换行
Print "0-59共有: " & a(0) & " 人"
Print "60-69共有: " & a(1) & " 人"
Print "70-79共有: " & a(2) & " 人"
Print "80-89共有: " & a(3) & " 人"
Print "90-100共有: " & a(4) & " 人"
End Sub

『伍』 java题,用类方法随机生成20名学生成绩成绩并计算平均分和总分,按总分排序

『陆』 excel表格 随机产生20或者25 excel表格 需要随机生成学生成绩,20分或者25分

输入

=CHOOSE(RANDBETWEEN(1,2),20,25)


详见附图

『柒』 编程 随机生成20个学生的成绩(60分—100分)(用数组存放数据) 输出最高分和最低分,平均分 利用数组

#include<stdio.h>
main()
{ double a[20],s=0.0;
int i ,j ,t;
for(i=0;i<20;i++)
{ scanf(a[i]);
s=s+a[i];
}
priintf(''平均分是%f '',s/20);
for(i=0;i<19;i++)
for(j=i+1;j<20;j++)
{ if(a[i]>a[j])
{ t=a[i];
a[i]=a[j];
a[j]=t;
}
}
printf("最大值为专%f,最小属值为%f",a[19],a[0]);

}

『捌』 VB设计:随机产生20个学生的成绩,并显示.统计各分数段人数,即50~59, 60~69, 70~79,80-89,90-100。

Option Explicit

Private Sub showScore()
Dim score(1 To 20) As Integer
Dim an(1 To 5) As Integer
Dim i As Integer
Randomize

For i = 1 To UBound(score)
score(i) = CInt(Rnd * 100)
Select Case score(i)
Case 0 To 59
an(1) = an(1) + 1
Case 60 To 69
an(2) = an(2) + 1
Case 70 To 79
an(3) = an(3) + 1
Case 80 To 89
an(4) = an(4) + 1
Case 90 To 100
an(5) = an(5) + 1
End Select
Next

For i = 1 To 5
Select Case i
Case 1
Print "0 - 59 :",
Case 2
Print "60 - 69:",
Case 3
Print "70 - 79:",
Case 4
Print "80 - 89:",
Case 5
Print "90 - 100:",
End Select
Print CStr(an(i))
Next
End Sub

Private Sub Form_Click()
Cls
showScore
End Sub

Private Sub Form_Load()
Me.AutoRedraw = True
showScore
End Sub

『玖』 VB程序,随机产生20个学生的成绩,并显示.统计各分数段人数,即0~59,60~69,70~79,8

Private Sub Command1_Click()

Dim a(20) As Integer

Cls

c1 = 0: c2 = 0: c3 = 0: c4 = 0: c5 = 0: c6 = 0

Randomize

Print "20个成绩:"

For i = 1 To 20

a(i) = Int(Rnd * 101)

Print a(i);

If i Mod 10 = 0 Then Print

Next i

For i = 1 To 20

If a(i) = 100 Then

c1 = c1 + 1

Else

If a(i) > 89 Then

c2 = c2 + 1

Else

If a(i) > 79 Then

c3 = c3 + 1

Else

If a(i) > 69 Then

c4 = c4 + 1

Else

If a(i) > 59 Then

c5 = c5 + 1

Else

c6 = c6 + 1

End If

End If

End If

End If

End If

Next i

Print: Print "统计结果:"

Print " 100分:"; c1

Print "90~99分:"; c2

Print "80~89分:"; c3

Print "70~79分:"; c4

Print "60~69分:"; c5

Print " 0~59分:"; c6

End Sub


或者换一种写法(运行效果完全一样):

Private Sub Command1_Click()

Dim a(20) As Integer

Dim cj(5 To 10) As Integer

Cls

Randomize

Print "20个成绩:"

For i = 1 To 20

a(i) = Int(Rnd * 101)

Print a(i);

t = a(i) 10

If t < 5 Then t = 5

cj(t) = cj(t) + 1

If i Mod 10 = 0 Then Print

Next i

Print: Print "统计结果:"

Print " 100分:"; cj(10)

Print "90~99分:"; cj(9)

Print "80~89分:"; cj(8)

Print "70~79分:"; cj(7)

Print "60~69分:"; cj(6)

Print " 0~59分:"; cj(5)

End Sub

『拾』 [vb]随机产生20个学生的成绩,统计各分数段人数。

Option Explicit
Dim d(1 To 20) As Integer
Private Sub Command1_Click()
Dim i As Integer
Picture1.Cls
For i = 1 To 20
d(i) = Int(Rnd() * 100) + 1
Picture1.Print Format(d(i), " 0");
If i Mod 4 = 0 Then Picture1.Print
Next i

End Sub

Private Sub Command2_Click()
Dim b(5) As Integer
Dim i As Integer
Picture2.Cls
For i = 1 To 20
Select Case d(i)
Case 0 To 59
b(1) = b(1) + 1
Case 60 To 69
b(2) = b(2) + 1
Case 70 To 79
b(3) = b(3) + 1
Case 80 To 89
b(4) = b(4) + 1
Case 90 To 100
b(5) = b(5) + 1
End Select
Next
Picture2.Print "0~:"; b(1); "个"
Picture2.Print "60~79:"; b(2); "个"
Picture2.Print "70~89:"; b(3); "个"
Picture2.Print "80~99:"; b(4); "个"
Picture2.Print "90~100:"; b(5); "个"

End Sub

Private Sub Form_Load()
Command1.Caption = "产生并显示数据"
Command2.Caption = "统计分数段人数"
End Sub

热点内容
武汉大学学生会辅导员寄语 发布:2021-03-16 21:44:16 浏览:612
七年级学生作文辅导学案 发布:2021-03-16 21:42:09 浏览:1
不屑弟高考成绩 发布:2021-03-16 21:40:59 浏览:754
大学毕业证会有成绩单 发布:2021-03-16 21:40:07 浏览:756
2017信阳学院辅导员招聘名单 发布:2021-03-16 21:40:02 浏览:800
查询重庆2018中考成绩查询 发布:2021-03-16 21:39:58 浏览:21
结业考试成绩怎么查询 发布:2021-03-16 21:28:40 浏览:679
14中医医师资格笔试考试成绩查分 发布:2021-03-16 21:28:39 浏览:655
名著赏析课程标准 发布:2021-03-16 21:27:57 浏览:881
北京大学商业领袖高端培训课程 发布:2021-03-16 21:27:41 浏览:919