b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

richtextbox获取某行_richtextbox 光标_richtextbox和textbox(19)

电脑杂谈  发布时间:2017-01-27 23:19:55  来源:网络整理

例3.17 输入10名学生的成绩,求出最高分和最 低分

(1)创建应用程序的用户界面和设置对象属性

(2) 编写程序代码

功能要求:通过array函数输入10个分数;单击“查找”按钮(command2)后,开始 查找最高分和最低分,找到后显示在标签label1上 option base 1 dim score as variant private sub form_load() label1.caption = "单击“查找”按钮开始查找最高分和最低分" score = array(89, 96, 81, 67, 79, 90, 63, 85, 95, 83) end sub private sub command1_click() dim max as integer, min as integer max = score(1) 设定初值 min = score(1) for i = 2 to 10 if max < score(i) then 找最高分 max = score(i) end if if min > score(i) then 找最低分 min = score(i) end if next i chr(13)起换行作用 label1.caption = "最高分:" + str(max) + _ chr(13) + "最低分:" + str(min) end sub

作业:课后3-9题

(1) 以下属于visual basic合法的数组元素是 a) x8 b) x[8] c) s(0)

(2) 下列语句正确的是 a) if a≠b then print "a不等于b" c) if a<>b then print "a不等于b" d) v[8] b) if a<>b then printf "a不等于b" d) if a≠b print "a不等于b"

(3)下列程序段的执行结果为 a=75 if a > 60 then i=1 if a > 70 then i=2 if a > 80 then i=3 if a < 90 then i=4 print "i="; i a) i=1 b) i=2 c) i=3 d) i=4 (4) 下列程序段的执行结果为 a=5 for k=1 to 0 a=a + k next k print k; a a) -1 6 b) –1 1 c) 1 5 d) 11 21 (5) 以下程序段运行时从键盘上输入字符"-",则输出结果为 op$=inputbox("op=") if op$="+" then a=a + 2 if op$="-" then a=a - 2 print a a) 2 b) –2 c) 0 d) +2

过程和函数

过程是构成程序逻辑部件的基本单位,将程序分割成较小的逻辑部件可以简 化程序设计任务,结构化设计就是建立在这个思路之上。 在 visual basic 中使用的过程有: sub 过程——不返回值;又被称做子过程。 function 过程——返回值;又被称做函数。

子过程

在 visual basic中子过程包括通用过程和事件过程,它们的定义语法类似, 差别是调用方式一般不同。 通用过程往往是由程序中的语句调用。


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-29087-19.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...