当前位置:编程学习 > VB >>

VB请教高手指导。。一道习题在不知道怎么编写。。

输入10个同学的成绩,A89,B79.c64,d88 e79,f91,g68,h58,i76,j78统计分数段人数,输入姓名查询每位同学的成绩。 --------------------编程问答-------------------- 这是程序中的基础了


定义二维数组 dim student(9,1)
student(0,0)=姓名
student(0,1)=分数
如些类推
查同学成绩就用 
str=InputBox("请输入姓名!")
得到姓名
弄个循环  
for i=0 to 9
         if studer(i,0)=str then
          msgbox "成绩为",student(i,1)
          exit sub
         end if
next
     
查分数段,不知道你用什么样的查询条件
比如60分以下,60-69分,70=79分,80-89分,90-100
dim p(4) as string
for i=0 to 9
if student(i,1)<60 then
p(0)=p(0) & student(i,0) & "-" & student(i,1) & ","
elseif student(i,1)>=60 and student(i,1)<70 then
p(1)=p(1) & student(i,0) & "-" & student(i,1) & ","
elseif student(i,1)>=70 and student(i,1)<80 then
p(2)=p(2) & student(i,0) & "-" & student(i,1) & ","
elseif student(i,1)>=80 and student(i,1)<90 then
p(3)=p(3) & student(i,0) & "-" & student(i,1) & ","
elseif student(i,1)>=90 and student(i,1)<=100 then
p(4)=p(4) & student(i,0) & "-" & student(i,1) & ","
else
msgbox "成绩有误"
end if
next
然后输出
用文本框吧
text1.text="60分以下的有" & p(0) & vbctrf & "60-70分以下的有" & p(1) & vbctrf & "70-80分以下的有" & p(2) & vbctrf & "80-90以下有的" & p(3) & vbctrf & "90-100的有" & p(4)

补充:VB ,  非技术类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,