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

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

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

if cj<60 then print "成绩不及格"

多行代码:

if cj<60 then print "成绩不及格“ print "请准备补考" end if

2.

格式:

if...then...else语句

真 e 假

if 条件 then 语句块1 else 语句块2 end if

(a)

a

b

(b)

功能:首先测试条件(e),如果条件成立(即值为真),则执行

then后面的语句块1,如果条件不成立(即值为假),则执行else后 面的语句块2。而在执行then或else之后的语句块后,会从end if 之后的语句继续执行。

例 输入三个数a、b、c,求出其中最大数

(1)创建应用程序的用户界面和设置对象属性 (2)编写程序代码 功能要求:用户在“a=‖文本框(text1)、“b=‖文 本框(text2)和“c=‖文本框(text3)中输入数据,单击 “判断”按钮后,则在“最大数=”文本框(text4)中 输出结果

程序代码

private sub command1_click() dim a as integer, b as integer dim c as integer, m as integer a = val(text1.text) b = val(text2.text) c = val(text3.text) if a > b then m=a else m=b end if if c > m then m = c text4.text = m end sub

m用来存放较大值

例 输入三个数,将它们从大到小排序

(1)建立应用程序的用户界面和设置对象属性 (2)编写程序代码 功能要求:用户从上面三个文本框(text1、text2、text3)中输 入数据,单击“排序”按钮(command1),则在第4个文本框 (text4)中显示结果

程序代码

private sub command1_click() a = val(text1.text) b = val(text2.text) c = val(text3.text) if a < b then t = a: a = b: b = t end if if a < c then t = a: a = c: c = t end if if b < c then t = b: b = c: c = t end if text4.text = a & "," & b & end sub

本条件语句实现a>=b

本条件语句实现a>=c

本条件语句实现b>=c

"," & c

3.块if结构

可以使用 if...then...else语句建立多个分支流程,并根 据条件选择其中一个分支。 if h < 12 then 语法结构: print "早上好!" elseif h < 18 then if 条件1 then print "下午好!" [语句块1] else print "晚上好!" [elseif 条件2 then end if [语句块2]] ...

先测试条件1,如果为假,就依次测试条件2,依此类 else 推,直到找到为真的条件。

[语句块n]] end if


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

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

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