do
a= inputbox("输入分数!"&vbcr&"输入-1结束分数输入!")
if a="-1" then
exit do
end if
if a <>"" then
Select Case int(a)\10
Case "0"bjg=bjg+1
Case "1"bjg=bjg+1
Case "2"bjg=bjg+1
Case "3"bjg=bjg+1
Case "4"bjg=bjg+1
Case "5"bjg=bjg+1
Case "6"jg=jg+1
Case "7"zh=zh+1
Case "8"li=li+1
Case "9"yx=yx+1
Case "10" mf=mf+1
Case Else msgbox "无效成绩!"
End Select
end if
loop
str = "59分以下:"&bjg&"个"&vbcr
str = str&" 60-69分:"&jg&"个"&vbcr
str = str&" 70-79分:"&zh&"个"&vbcr
str = str&" 80-89分:"&li&"个"&vbcr
str = str&" 90-99分:"&yx&"个"&vbcr
str = str&" 100分:"&mf&"个"
msgbox str,,"成绩统计!"
#include <stdio.h>void main()
{
int i, n, renofloat score[30], avr, a, b, c
char name[30][9]
for(i = 0i <30i++)
{
printf("%d号的成绩:", i+1)scanf("%f", &score[i])
if(score[i] <0) break
printf("%d号的姓名:", i+1)scanf("%s", name[i])
}
n = i
printf("统计不及格人数:\n")
reno = 0avr = 0
for(i = 0i <ni++)
{
if( score[i] <60) { reno++printf("%d, %s\n", i+1, name[i])}
avr += score[i]
}
printf("不及格人数为%d\n\n", reno)
printf("统计成绩在平均分及平均分之上的学生人数:\n")
avr /= nreno = 0
for(i = 0i <ni++)
{
if(score[i] >= avr) { reno++printf("%d, %s\n", i+1, name[i])}
}
printf("成绩在平均分及平均分之上的学生人数为%d\n\n", reno)
printf("统计各分数段的人数及所占百分比(分数段为<60,60~79,>=80):\n")
a = b = c =0
for(i = 0i <ni++)
{
if(score[i] <60) a++
else if(score[i] >= 80) c++
else b++
}
printf("<60:\t%.1f%%\n60~79:\t%.1f%%\n>=80:\t%.1f%%\n",100*a/n,100*b/n,100*c/n)
}
#include <stdio.h>int main()
{
float x[8]={9.2,9.5,9.0,8.9,9.3,9.5,9.1,9.0}
float max, min
int i
float avg = 0
max = min = x[0]
for (i = 0i <8i++)
{
if (x[i] >max)
{
max = x[i]
}
if (x[i] <min)
{
min = x[i]
}
avg += x[i]
}
avg = (avg - max - min) / 6
printf("the avrage sorce is: %f.\n", avg)
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)