期末老师总结课件

上传人:ji****n 文档编号:54796786 上传时间:2018-09-19 格式:PPT 页数:25 大小:230KB
返回 下载 相关 举报
期末老师总结课件_第1页
第1页 / 共25页
期末老师总结课件_第2页
第2页 / 共25页
期末老师总结课件_第3页
第3页 / 共25页
期末老师总结课件_第4页
第4页 / 共25页
期末老师总结课件_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《期末老师总结课件》由会员分享,可在线阅读,更多相关《期末老师总结课件(25页珍藏版)》请在金锄头文库上搜索。

1、,Visual Basic 程序设计,2009年9月,目录,概述,enter,课程小结,第二章 程序设计基础,标识符的命名规则 字母、数字、下划线组成 以字母开头 不能与VB标准关键字相同 最长255字符,第二章 程序设计基础,VB的数据类型 数值型 整数数据:整型(integer)、长整型(long) 小数数据:单精度(single) 双精度(double) 字符型(string) 逻辑型|布尔型(boolean) 日期型 (Date) 变体型 (Variant),第二章 程序设计基础,常量 一般常量:数值常量、字符常量、逻辑常量(boolean)、日期型常量 符号常量 定义形式,语法:pu

2、blic|private const 常量名 as 数据类型=表达式 注意:常量值在程序中不允许修改,第二章 程序设计基础,变量 定义形式,语法:Dim 变量名as 数据类型,变量名as 数据类型 各种定义范例dim a1 as integerdim a as boolean, b as integerdim a2 as string,第二章 程序设计基础,变量 赋值,语法: 变量名=表达式 各种定义范例dim a as stringdim b as integera=“hello”b=1,第二章 程序设计基础,运算符和表达式 算术运算符 关系运算符 连接运算符 逻辑运算符运算的优先级(p28

3、),+ - * / mod, = = ,+ &,and or not,Print 13 / 5.2, 13 5.2, 13 Mod 5.2 Print 5-24*8/2 mod 52,2.5 2 3 5,第二章 程序设计基础,内部函数 输入与输出 InputBox、MsgBox Print,在窗体上有个命令按钮,然后编写如下事件过程:b m=InputBox(“enter the first integer“) n=InputBox(“enter the second integer“) Print n+m 程序运行后,单击命令按钮,先后输入“1”和“5” 则输出结果为 a) 1 b) 51

4、c) 6 d) 15,第三章 程序控制结构,VB的基本控制结构 顺序结构、分支结构、循环结构 顺序控制结构 赋值语句,第三章 程序控制结构,选择结构 If thenelse,If 条件 then 执行语句,Dim a as integer A=3 If a5 then print a,第三章 程序控制结构,选择结构 If thenelse,If 条件 then 执行语句,Dim a as integer A=3 If a5 then print a,If 条件 then 执行语句 Else 执行语句 End if,A=1 If a=1 then print “正确” Else print “错

5、误” End if,第三章 程序控制结构,选择结构 If thenelse,If 条件1 then 执行语句 Elseif 条件2 then执行语句 Else执行语句 End if,Dim a as integer A=val(text1.text) If a50 then print “偏大” Elseif a0,注意用Is0表示 4、组合形式,逗号分隔-10,1 to 100,Select case 变量|表达式 case 值1语句 Case 值2语句 Case else语句 End select,第三章 程序控制结构,选择结构 Select case结构,Dim a as integer

6、 A=val(text1.text) Select Case a Case Is 50Print “偏大“ Case Is 30Print “偏小“ Case ElsePrint “适中“ End Select,第三章 程序控制结构,循环结构 DoLoop结构,Do while|until 条件A语句块Bexit do Loop,第三章 程序控制结构,循环结构 DoLoop结构,Do语句块exit do Loop while|until 条件,第三章 程序控制结构,循环结构 Fornext循环,For 计数器=初始值 to 终值 step 步长语句块exit for next 计数器,For

7、i = 1 To 10 Step 1.5n = n + 1 Next Print nN的值为7,第三章 程序控制结构,数组 一维数组的定义二维数组的定义,dim 数组名(第1维上下界) as 数据类型,dim 数组名(第1维上下界,第2维上下界) as 数据类型,第三章 程序控制结构,数组,定义存放10个整数的一维数组 Dim a(9) as integerDim a(1 to 10) as integerDim total as integer Total=9 Dim a(total) as integer,定义一个2行3列的二维整型数组Dim a(1 to 2,1 to 3) as int

8、egerDim a(1,2) as integer,第三章 程序控制结构,数组的赋值,Dim a(1 to 5) as integer Dim j as integerFor j=1 to 5a(j)=j next,Dim a(1 to 2,1 to 3) as integer Dim m as integer,n as integerFor m=1 to 2for n=1 to 3a(m,n)=nnext n Next m,第三章 程序控制结构,数组的元素个数,数组个数计算: (上界1-下界1+1)*(上界2-下界2+1),第四章 应用界面设计,窗体: 什么是窗体 常用属性: Caption:标题相关事件和方法 Load事件(注意事件名) Click事件 Show hide move,第四章 应用界面设计,标签 常用属性:Caption:标题文本框 常用属性:text:文本框内容 焦点 选项按钮和复选框 属性:value,第四章 应用界面设计,列表和组合 图像与图片 定时器 滚动条 菜单,

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 初中教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号