求某数学小组测验成绩的平均分和标准差编写一程序
书本上的问题是
编写一程序.求某数学小组测验成绩的平均分和标准差
VB求平均分和标准差
答案:2 悬赏:10 手机版
解决时间 2021-02-08 16:34
- 提问者网友:酱爆肉
- 2021-02-07 20:50
最佳答案
- 五星知识达人网友:痴妹与他
- 2021-02-07 21:02
private sub command1_click()
dim score(1 to 5) as integer
dim i as integer
for i=1 to 5
score(i)=cint(inputbox("Input Score"+cstr(i)))
next i
dim avg as double
avg=score(1)+score(2)+score(3)+score(4)+score(5)
avg=avg/5
dim stdd as double
for i=1 to 5
stdd=stdd+(score(i)-avg)*(score(i)-avg)
next i
stdd=stdd/5
stdd=sqrt(stdd)
msgbox "Average Score="+cstr(avg)+",Standard Differential="+cstr(stdd)
exit sub
dim score(1 to 5) as integer
dim i as integer
for i=1 to 5
score(i)=cint(inputbox("Input Score"+cstr(i)))
next i
dim avg as double
avg=score(1)+score(2)+score(3)+score(4)+score(5)
avg=avg/5
dim stdd as double
for i=1 to 5
stdd=stdd+(score(i)-avg)*(score(i)-avg)
next i
stdd=stdd/5
stdd=sqrt(stdd)
msgbox "Average Score="+cstr(avg)+",Standard Differential="+cstr(stdd)
exit sub
全部回答
- 1楼网友:孤独入客枕
- 2021-02-07 21:51
private sub command1_click()
dim score(1 to 5) as integer
dim i as integer
for i=1 to 5
score(i)=cint(inputbox("input score"+cstr(i)))
next i
dim avg as double
avg=score(1)+score(2)+score(3)+score(4)+score(5)
avg=avg/5
dim stdd as double
for i=1 to 5
stdd=stdd+(score(i)-avg)*(score(i)-avg)
next i
stdd=stdd/5
stdd=sqrt(stdd)
msgbox "average score="+cstr(avg)+",standard differential="+cstr(stdd)
exit sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯