Visual Basic 程序设计基础教程-课后习题答案-范荣强

合集下载

visual basic程序设计课后编程答案

visual  basic程序设计课后编程答案

Dim n As Integern=Text1.TextIF(n Mod 4 =0 And n mod 100< >0 or n mod 400 = 0)Then Text2.text =”闰年”ElseText2.text=”非闰年”End IF求和求积Dim i As integerOpen App.path&”\jsdata.txt”For input As #1For i =1 to 15Input #1,arr(i)Next iIf op1.value=ture thenT1.text=Aaa()End ifIf op2.value=ture thenT1.text=Bbb()End ifClose #1写入文件****Dim i As Integer, j As Integer, n As IntegerOpen app.path &”\zfwj.txt”for output As #1n=val(text1.text)for I =1 to nfor j=1 to iprint #1,”*”;next jprint #1next I close#1计算结果dim n As Integer, I As Integer, s1 As integer,s2 As long n=val(text1.textfor I =1 to ns1=s1+is2=s2+s1next itext2.text=s2求值dim n1 as integer, n2 as integer, n3 as integer,t as integer n1= val(text1.text)n2=val(text2.text)n3=val(text3.text)if n1<n2 then t=n1:n1=n2:n2=tif n2<n3 then t=n2:2=n3:3=tif n1<n2 then t =n1:1=n2:2=ttext4.text=n1text5.text=n3建立文件显示文件Dim num as string,name as srting, I as integerOpen App.path&”\xhxm.txt”for output As #1For I = 1 to 3num=inputbox(“请输入学号:“)name = inputbox(“请输入姓名:“)write #1,num,namenext iclose #1End sub Private sub command2_click()Dim s as string, I as integerOpen app.path &\xhxm.txt” for input as # 1Do While Not EoF(1)Line input # 1,sText1.text= text1.text& s & vbCrLfLoopClose #1第三卷求和输入N值Dim n As integer, I as integer, sum as integerN= val(text1.text)For I = 1 to nIf I mod 3 =0 then sum = sum+ iNext iText2.text=sum输入正整数NDim m As integer, n as integerPrivate sub commad1_click(0Dim c as doubleN=text1.textM=text2.textIf n<=m thenC=fact(m)/(fact(n)* fact(m-n))Text3.text=cElseMsgbox”输入的n必须小于等于m!请重新输入“Text1.text=””Text2.text=””Text1.setfocusEnd ifEnd sub读入数据统计英文字母Dim s as stringOpen app.path&”\yy.txt”for input as #1Do while not EOF(1)Line input #1,sText1.text=text1.text &s &vbCrLfLoopClose #1End subPrivate sub command2_click()Dim n as integer, I as integer, s As integer, c as stringN= Len(text1.text)For I = 1 to nC= mid(text1.text,I,1)If c >=”a”and c <=”z” or c 》=“a” and c <=”z” then s =s+1 Next iLabel1.caption= “共“& s &”个英文字母”End sub第四卷转换十进制Dim n as integer,b as stringN=text1.textB=zh(n)Text2.text=b读取文件加密Dim s1 as stringPrivate sub command1_click()Open app.path &”\jmwb.txt”for input as #1Input #1,s1Text1.text=s1End subPrivate sub command2_click()Dim n As integer, I as integer dim s2 as string, j As stringN=Len(s1)For I =1 to nJ=mid(s1,I,1)J=chr(asc(j)+5)S2=s2&jNext iText2.text=s2生成数组降序排列Option base 1Dim n AS integer,x(15) as integerPrivate Sub command1_Click(0Dim s1 as stringFor N= 1 to 15X(N)=int(91 * Rnd +10)S1=s1 &STR(x(N))Next NText1.text =s1End subPrivate sub command2_click()Dim s2 as stringDim I as integer, j AS integer t as integerFor I =1 to 15For j 1 to 15For j=I +1 to 15If x (i)<x(j) thenT=x(i)X(i)=x(j)X(j)=tEnd ifNext jS2=s2& Str(x(i))Next IText2.text =s2End sub第五卷判断字符还是字母Dim s as stringCall Getchar(s)Text1.text=sIf Asc(s)>= Asc(“A”) and asc (s)<=asc(“z”) or asc (s)>=Asc(“a”) And asc (s)<=asc(“z”) then Label1.caption=”是字母字符“ElseIf asc(s)>=asc(”0”) and asc(s)<= asc(“s)<=asc(“9”) thenLabel1.caption=”是数字字符“ElseLabel1.caption=”是其他字符”End ifEnd sub生成三个随机数Dim n1 as integer, n2 as integern1=val(text1.text)n2=val(text2.text)label1.caption=int((n2-n1+1)*Rnd +n1)label2.caption=int((n2-n1+1)*Rnd+n1)label3.caption=int((n2-n1+1)*Rnd+n1)end sub转换大写小写Dim a as stringPrivate sub command1_click()Text1.text=UCase(a)End subPrivate sub command1_click()Text1.text=LCase(a)End subPrivate sub command3_click()Text1.text=aEnd subPrivate sub text1_keypress(keyascii as integer)If not((keyascii>=65 and keyascii<=90)or (keyascii>= 97 And keyascii<=122)) then BeepKeyascii =0End Ifa=Text1.textend sub。

VisualBasic程序设计教程第版课后部分编程题参考答案(一)

VisualBasic程序设计教程第版课后部分编程题参考答案(一)

VisualBasic程序设计教程第版课后部分编程题参考答案(一)Visual Basic 程序设计教程是程序员必备的一本教材。

而其第四版中也包含了大量课后编程题,能够帮助读者深入理解 Visual Basic 程序设计的核心内容。

本文就来为大家介绍一下这部分编程题的参考答案。

一、数据类型和运算符1. 将两个整数相加Dim num1, num2, result As Integernum1 = 10num2 = 20result = num1 + num2MsgBox ("The result of adding " & num1 & " and " & num2 & " is " & result & ".")2. 将两个小数相减Dim num1, num2, result As Doublenum1 = 2.5num2 = 1.2result = num1 - num2MsgBox ("The result of subtracting " & num2 & " from " & num1 & " is " & result & ".")3. 将两个字符拼接在一起Dim str1, str2, result As Stringstr1 = "Hello"str2 = "World"result = Str1 + Str2MsgBox ("The result of concatenating " & str1 & " and " & str2 & " is " & result & ".")二、程序结构和函数1. 将两个整数相加并返回结果Public Function Add(ByVal num1 As Integer, ByVal num2 As Integer) As IntegerDim result As Integerresult = num1 + num2Return resultEnd Function2. 获取当前日期和时间Dim currentDateTime As StringcurrentDateTime = Now()MsgBox ("The current date and time is " & currentDateTime & ".")3. 显示一个消息框并返回用户的选择Dim userInput As IntegeruserInput = MsgBox("This is a prompt. Would you like tocontinue?", vbYesNoCancel, "Message Box Test")MsgBox ("Your choice was " & userInput & ".")三、数组和结构1. 将一个整数数组按照升序排列Dim numArray() As IntegernumArray = {5, 10, 2, 8, 1}Array.Sort(numArray)MsgBox ("The sorted array is " & Join(numArray, ", ") & ".")2. 创建一个结构体表示一个人,包含姓名、年龄和性别字段Public Structure PersonPublic Name As StringPublic Age As IntegerPublic Gender As StringEnd Structure3. 创建一个数组表示一个班级的学生,使用 Person 结构体表示每个学生的信息Dim students(2) As Personstudents(0).Name = "Tom"students(0).Age = 16students(0).Gender = "Male"students(1).Name = "Jane"students(1).Age = 15students(1).Gender = "Female"students(2).Name = "Bob"students(2).Age = 17students(2).Gender = "Male"四、文件和数据库1. 读取一个文本文件中的内容并显示Dim filePath As String ="C:\Users\UserName\Documents\MyFile.txt"Dim fileText As StringfileText = File.ReadAllText(filePath)MsgBox ("The contents of the file are " & fileText & ".")2. 将一个字符串写入到一个新建的文本文件中Dim filePath As String ="C:\Users\UserName\Documents\NewFile.txt"Dim fileContent As StringfileContent = "This is the content of the new file."File.WriteAllText(filePath, fileContent)MsgBox ("The file was created and the following content was written to it: " & fileContent & ".")3. 从一个 SQL 数据库中查询某个表格的内容Dim connectionString As String = "DataSource=myServerName;Initial Catalog=myDataBase;UserId=myUsername;Password=myPassword;"Dim query As String = "SELECT * FROM myTable"Dim dataTable As New DataTable()Using connection As New SqlConnection(connectionString)connection.Open()Using command As New SqlCommand(query, connection)Using adapter As New SqlDataAdapter(command)adapter.Fill(dataTable)End UsingEnd UsingEnd UsingMsgBox ("The following records were retrieved from the database: " & vbNewLine & DataTableToString(dataTable))这些编程题的参考答案可以帮助读者理解 Visual Basic 程序设计的一些基本概念和技术,希望读者能够结合自己的实际情况进行学习和练习,不断提高自己的编程水平。

visual_Basic程序设计教程_课后习题答案及练习

visual_Basic程序设计教程_课后习题答案及练习
《VB程序设计》综合复习资料
第一章Visual Basic程序设计概述
一、填空题
1、VisualBasic就是一种面向__________得可视化程序设计语言,采取了__________得编程机制。
2、在VB中工程文件得扩展名就是____________,窗体文件得扩展名就是____________,标准模块文件得扩展名就是____________。
B.一个工程文件由若干个窗体文件组成
C.不需要编写大量代码来描述图形对象ﻩ
D.所见即所得
3、下列不能打开属性窗口得操作就是( )
A。执行“视图”菜单中得“属性窗口”命令
B.按F4键C.按Ctrl+T
D.单击工具栏上得“属性窗口”按钮
4、下列可以打开立即窗口得操作就是( )
A.Ctrl+DB、Ctrl+EC。Ctrl+FD.Ctrl+G
D。文本框得LOCKED属性为FALSE
12、在运行阶段,要在文本框TEXT1获得焦点时选中文本框中所有内容,对应得事件过程就是()
A.Private SubText1_GotFocus( )
Text1、SelStart=0
Text1。Sellength=Len(Text1。Text)
EndSub
B.PrivateSubText1_LostFocus( )
4、设置控件背景颜色得属性名称就是______________________。
5、所有控件都具有得共同属性就是__________________属性。
6、一般情况下,控件有两个属性项得缺省值就是相同得,这两个属性项就是_______________。
7、VB中得每个对象(控件)都有一组特征,这组特征称为__________,我们通过修改它可以控制对象得外观与操作、

visual_Basic程序的设计教程_课后习题答案及练习

visual_Basic程序的设计教程_课后习题答案及练习

visual_Basic程序的设计教程_课后习题答案及练习《VB程序设计》综合复习资料第一章 Visual Basic程序设计概述一、填空题1、Visual Basic是一种面向__________的可视化程序设计语言,采取了__________的编程机制。

2、在VB中工程文件的扩展名是____________,窗体文件的扩展名是____________,标准模块文件的扩展名是____________。

3、执行“工程”菜单下的__________命令,可选择并添加ActiveX控件。

4、Visual Basic 6.0用于开发__________环境下的应用程序。

二、选择题1、下面不是VB工作模式的是()A.设计模式B.运行模式C.汇编模式D.中断模式2、可视化编程的最大优点是()A.具有标准工具箱B.一个工程文件由若干个窗体文件组成C.不需要编写大量代码来描述图形对象D.所见即所得3、下列不能打开属性窗口的操作是()A.执行“视图”菜单中的“属性窗口”命令B.按F4键 C.按Ctrl+TD.单击工具栏上的“属性窗口”按钮4、下列可以打开立即窗口的操作是()A.Ctrl+D B.Ctrl+E C.Ctrl+F D.Ctrl+G5、Visual Basic的编程机制是()A.可视化 B.面向对象 C.面向图形 D.事件驱动三、简答题1、代码窗口主要包括哪几部分?2、在工程资源管理器窗口中,主要列出了哪三类文件?3、窗体布局窗口的主要用途是什么?4、VB的基本特点是什么?5、怎样理解可视化设计?6、怎要理解事件驱动编程?第二章简单的VB程序设计一、填空题1、设置是否可以用Tab键来选取命令按钮,应该用______________属性。

2、一个控件在窗体的位置由_______和________属性决定,其大小由__________和_________属性决定。

3、利用对象的属性setfocus可获得焦点,对于一个对象,只有其visible属性和____________属性为true,才能接受焦点。

《Visual Basic程序设计教程(第2版)》课后部分编程题参考答案

《Visual Basic程序设计教程(第2版)》课后部分编程题参考答案

第1章1. 按要求设置窗体属性2.在窗体上建立一个标签Label1。

程序代码如下:Private Sub Form_Click()Label1.Caption = "你单击了窗体"End SubPrivate Sub Form_DblClick()Label1.Caption = "你双击了窗体"End Sub3.在窗体上建立两个文本框Text1(输入数)、Text2(输出数)和一个命令按钮Command1。

两个文本框的Text属性均为空。

Private Sub Command1_Click()Dim x As Singlex = Val(Text1.Text)Text2.Text = 15 * xEnd Sub第2章1~3题:按要求完成操作练习。

4. Private Sub Command1_Click() '"最大化"按钮Form1.WindowState = 2 '最大化End SubPrivate Sub Command2_Click() '"还原"按钮Form1.WindowState = 0 '还原End SubPrivate Sub Command3_Click() '"最小化"按钮Form1.WindowState = 1 '最小化End Sub5.在窗体上建立三个文本框Text1(第一个数)、Text2(第二个数)、Text3(计算结果)和一个命令按钮Command1(“计算”)。

Private Sub Command1_Click()Dim x As SingleDim y As Singlex = Val(Text1.Text)y = Val(Text2.Text)Text3.Text = x * x + y * yEnd Sub6. 在窗体上建立两个文本框Text1(输入一串字符)、Text2(输出结果)和一个命令按钮Command1。

VisualBasic程序设计课后题答案

VisualBasic程序设计课后题答案

Vb课后题答案参考答案第1章概述第3章常用标准控件二.选择题:1.C2. B3.C.4.D5.B6.B7.A8.C9.B 10.C11.C 12.A 13.C 14.B 15.D16.D 17.C 18.A 19.D 20.A 21.B三.编程及上机调试:1.Private Sub Check1_Click()If Check1.Value = 1 ThenText1.FontBold = TrueElseText1.FontBold = FalseEnd IfEnd SubPrivate Sub Check2_Click()If Check2.Value = 1 ThenText1.FontItalic = TrueElseText1.FontItalic = FalseEnd IfEnd SubPrivate Sub Check3_Click()If Check1.Value = 1 ThenText1.FontUnderline = TrueElseText1.FontUnderline = FalseEnd IfEnd SubPrivate Sub Command1_Click()Text1.Text = " "End Sub2.Private Sub Command1_Click()Text2.Text = List1.ListCountPrivate Sub Command2_Click()List1.AddItem Text1.TextText1.Text = " "End SubPrivate Sub Command3_Click()Dim i As Integeri = List1.ListIndexList1.RemoveItem iCommand3.Enabled = FalseText1.SetFocusText2.Text = List1.ListCountEnd SubPrivate Sub Form_Load()Command3.Enabled = FalseEnd SubPrivate Sub List1_Click()Command3.Enabled = TrueEnd Sub第4章VB语言基础二.选择题:1.A2. D3.D.4.A5.A6.A7.C8.D9.C 10.B11.A 12.D 13.C 14.A 15.A16.C 17.D 18.A 19.B 20.D21.C 22.A 23.B 24.C 25.C三.编程及上机调试:1.Private Sub Form_Load()Dim x As Integer, s As String, d As IntegerRandomizex = Int(Rnd * 9000 + 1000)s = Trim(CStr(x))d = Val(Right(s, 1) + Mid(s, 3, 1) + Mid(s, 2, 1) + Left(s, 1))ShowPrint "产生的数;"; x; "倒序数"; dEnd Sub2.Private Sub Form_KeyPress(KeyAscii As Integer)Print "输入字符:"; Chr(KeyAscii), "ASCII码为:"; KeyAsciiPrivate Sub Form_DblClick()ClsEnd Sub3.Private Sub Form_Click()MsgBox "在这里显示提示" & vbCrLf & "提示信息", 2 + 16, "请确认"End Sub或Private Sub Form_Click()MsgBox "在这里显示提示" + Chr(13) + "提示信息", vbAbortRetryIgnore _ + vbCritical, "请确认"End Sub第5章程序控制结构二.单选题1.D2. C3.C.4.D.5.B6.C7.A8.A9.D 10.C11.C 12.C 13.B 14.B四.编程及上机调试1. Private Sub Form_Click()Dim x As Integer, y As Integerx = InputBox("请输入一个数值")If x > 20 Theny = x ^ 2 + 3 * x + 2ElseIf x >= 10 Theny = Sqr(3 * x) - 2ElseIf x > 0 Theny = 1 / x + Abs(x)End IfPrint "x="; x, "y="; yEnd Sub(2)Select Case实现:Private Sub Form_Click()Dim x As Integer, y As Integerx = InputBox("请输入一个数值")Select Case xCase Is > 20y = x ^ 2 + 3 * x + 2Case 10 To 20y = Sqr(3 * x) - 2Case Is > 0y = 1 / x + Abs(x)End SelectPrint "x="; x, "y="; yEnd Sub2.Private Sub Form_Click()Dim a As Integer, b As Integer, c As IntegerFor i = 100 To 999a = i \ 100b = (i - a * 100) \ 10c = i Mod 10If a ^ 3 + b ^ 3 + c ^ 3 = i ThenPrint i;k = k + 1If k Mod 2 = 0 Then PrintEnd IfNext iEnd Sub3.Private Sub Command1_Click()p = 60: r = 0.014Dop = p * (1 + r)n = n + 1Loop Until p >= 70Print n; "年后世界人口达到"; p; "亿"End Sub4.Private Sub Command1_Click()Dim s As Single, x As Integer, t As Single, n As Integer x = Val(InputBox("请输入x的值", , 2))s = 1n = 1m = 1Don = n + 1m = -mt = m * n / x ^ (n - 1)If Abs(t) < 0.00001 Then Exit Dos = s + tLoopPrint sEnd Sub第6章数组二.单选题:1.A2.A.3.A4.C5.D6.D7.A8.D9.B 10.B四.编程及上机调试:1.Option Base 1Private Sub Form_Click()Dim a(10) As IntegerDim i As Integer, t As IntegerPrint "数组的原始数据为:";For i = 1 To 10a(i) = Int(11 * Rnd) + 10Print a(i);Next iPrintPrint "变化后数组数据为:";For i = 1 To 5t = a(i)a(i) = a(10 - i + 1)a(10 - i + 1) = tNext iFor i = 1 To 10Print a(i);Next iEnd Sub2.Option Base 1Private Sub Form_Click()Dim a(3, 4) As Integer, i As Integer, j As Integer, k As Integer, p As Integer RandomizeFor i = 1 To 3For j = 1 To 4a(i, j) = Int(90 * Rnd + 10)Print a(i, j);Next jPrintNext iMax = a(1, 1): k = 1: p = 1For i = 1 To 3For j = 1 To 4If a(i, j) > Max ThenMax = a(i, j)k = ip = jEnd IfNext jNext iPrint "最大的数为第" & k & "行,第" & p & "列的数:" & MaxEnd Sub3.Option Base 1Dim a(4, 5) As Integer '在窗体声明段声明数组Dim i As Integer, j As IntegerPrivate Sub cmdmatrix_Click() '"生成数组"按钮RandomizeFor i = 1 To 4For j = 1 To 5a(i, j) = Int(Rnd * 10) '一位的随机数Picture1.Print a(i, j); '输出元素Next jPicture1.PrintNext iEnd SubPrivate Sub cmdcol_Click() '"求列和"按钮Dim colsum As Integertxtcol.Text = ""For j = 1 To 5 '列变量先循环colsum = 0For i = 1 To 4colsum = colsum + a(i, j)Next itxtcol.Text = txtcol.Text & Str(colsum)Next jEnd SubPrivate Sub cmdrow_Click() '"求行和"按钮Dim rowsum As Integertxtrow.Text = ""For i = 1 To 4 '行变量先循环rowsum = 0For j = 1 To 5rowsum = rowsum + a(i, j)Next jtxtrow.Text = txtrow.Text & CStr(rowsum) & vbCrLfNext iEnd SubPrivate Sub cmdclear_Click() '"清除"按钮Picture1.Clstxtcol.Text = ""txtrow.Text = ""End SubPrivate Sub cmdexit_Click() '"结束"按钮EndEnd Sub4. Option Base 1Private Sub Form_Click()Dim a() As Integer, b() As Integer, i As Integer, j As Integer, x As Integer, y As Integer x = InputBox("第一维上界")Do While Not IsNumeric(x)x = Int(InputBox("第一维上界"))Loopy = InputBox("第二维上界")Do While Not IsNumeric(x)y = Int(InputBox("第二维上界"))LoopReDim a(x, y)Print "原数组元素为:"For i = 1 To xFor j = 1 To ya(i, j) = Int(90 * Rnd) + 10Print a(i, j);Next jPrintNext iPrint "转置后数组元素为:"For i = 1 To yFor j = 1 To xPrint a(j, i);Next jPrintNext iEnd Sub5. Option Base 1Private Sub Form_Click()Dim a(10, 10) As Integer, i As Integer, j As IntegerFor i = 1 To 10For j = 1 To 10If i = j Or i + j = 11 Thena(i, j) = 0Elsea(i, j) = 1End IfPrint a(i, j);Next jPrintNext iEnd Sub6. Option ExplicitOption Base 1Private Sub Command1_Click()Dim i As Integer, j As Integer, n As Integer, k As Integer, a(11) As Integerj = 1For i = 3 To 21 Step 2a(j) = iPrint a(j);j = j + 1Next iPrintn = InputBox("请输入一个数")For i = 1 To 10If n = a(i) ThenFor j = i To 10a(j) = a(j + 1)k = k + 1Next jEnd IfNext iFor i = 1 To 9Print a(i);Next iEnd Sub7. Option Base 1Private Sub Form_Click()Dim a As Variant, k As Integer, i As Integer, j As IntegerDim b As Variantb = Array(17, 35, 128, 235, 89, 121, 143, 189, 231, 94)a = Array(11.3, 12.3, 12#, 11.8, 12.6, 11.6, 12.8, 11.8, 12.4, 12.1)For i = 1 To 9 '对数组a的元素排序k = iFor j = i + 1 To 10If a(k) > a(j) Then k = jNext jIf k <> i Then '数组b的元素随数组a的元素一起变动t = a(i)a(i) = a(k)a(k) = tt = b(i)b(i) = b(k)b(k) = tEnd IfNext iPrint "按名字的排列顺序为:"For i = 1 To 10If Len(b(i)) = 2 Then b(i) = "0" & b(i) '补上数组b中长度为2的编号前的"0"Print "第" & i & "名的号码为:" & b(i) & ",成绩为:" & a(i)Next iEnd Sub。

《Visual Basic程序设计教程(第2版)》课后部分编程题参考答案

《Visual Basic程序设计教程(第2版)》课后部分编程题参考答案

第1章1.按要求设置窗体属性2.在窗体上建立一个标签Label1。

程序代码如下:Private Sub Form_Click()Label1.Caption="你单击了窗体"End SubPrivate Sub Form_DblClick()Label1.Caption="你双击了窗体"End Sub3.在窗体上建立两个文本框Text1(输入数)、Text2(输出数)和一个命令按钮Command1。

两个文本框的Text属性均为空。

Private Sub Command1_Click()Dim x As Singlex=Val(Text1.Text)Text2.Text=15*xEnd Sub第2章1~3题:按要求完成操作练习。

4.Private Sub Command1_Click()'"最大化"按钮Form1.WindowState=2'最大化End SubPrivate Sub Command2_Click()'"还原"按钮Form1.WindowState=0'还原End SubPrivate Sub Command3_Click()'"最小化"按钮Form1.WindowState=1'最小化End Sub5.在窗体上建立三个文本框Text1(第一个数)、Text2(第二个数)、Text3(计算结果)和一个命令按钮Command1(“计算”)。

Private Sub Command1_Click()Dim x As SingleDim y As Singlex=Val(Text1.Text)y=Val(Text2.Text)Text3.Text=x*x+y*yEnd Sub6.在窗体上建立两个文本框Text1(输入一串字符)、Text2(输出结果)和一个命令按钮Command1。

《Visual Basic程序设计教程(第2版)》习题参考答案

《Visual Basic程序设计教程(第2版)》习题参考答案

习题1一、单选题1.D 2.D 3.B 4.B 5.C 6.A7.A 8.A 9.B 10.B 11.B 12.B二、多选题1.ADE 2.AB 3.BCDE 4.CD 5.CE三、填空题1.属性,方法,事件 2.解释,编译 3.设计,运行,中断 4.Command2_Click 5.中央,代码 6.MyForm.frm 7.(1)Cmd1_Click(),(2)Txt1.Text="VB语言程序设计"习题2一、单选题1.(1)A,(2)C 2.A 3.B 4.B 5.B 6.D 7.B 8.A 9.A 10.B 11.B 12.A 13.B二、多选题1.BD 2.CD 3. AD三、填空题1.(1) (2+x*y)/(2–y*y) (2) a^2–3*a*b/(3+a)(3) x^(3/8)+Sqr(y^2+4*a^2a/(x+y^3))2.Int(50+6*Rnd)3.(1)138, (2)3, (3)214, (4) 70, (5) "45", (6)04. "系统管理数据库"习题3一、单选题1.C 2.B 3.B 4.D 5.B 6.C 7.B 8.D 9.C 10.(1)A, (2)C 11.A 12.B 13.D 14.B二、多选题1.AC 2.ABF 3.BE三、填空题1.$000,124 2.Label1.Caption="a*b=" 3.Height,Width4.2 5.Text1.SetFocus6.Multiline, ScrollBars, 2 7.24,2423习题4一、单选题1.C 2.B 3.C 4.C 5.D 6.B 7.(1)D,(2)A,(3)B 二、多选题1.ABCFGHJ 2.BE 3.CDE 4.AE三、填空题1.60000 2.O&pen 3.(1) "0" To "9";(2) "a" To "z", "A" To "Z";(3) Else习题5一、单选题1.C 2.(1)D,(2)C 3.A 4.(1)B,(2)C,(3)B 5.B 6.B二、填空题1.(1) 4次,n=13;(2) 3次,n=8;(3) 3次,n=27;(4) 1次,n=12 2.227 3.0 4.Style 5.下拉列表框6.AddItem,RemoveItem或Clear 7.(1)ItemA,(2) ItemD,(3) ItemD,(4) ItemA习题6一、单选题1.D 2.A 3.B 4.C 5.C 6.A 7.(1)D (2)A (3)B 二、多选题1.AD 2.CD三、填空题1.二, 12; 1, 3; -1, 22. 0 1 2 31 0 1 22 1 0 13 2 1 03. Name, Index 4.(1) 0 To Index, (2)Val(Text1(k).Text)习题7一、单选题1.B 2.C 3.B 4.B 5.C 6.D 7.A 8.C 9.D 10.C 二、填空题1.EF 2.(1)14,(2) 2,(3)10 3.(1)10,(2)28,(3)6,(4) 64.(1)Power(x,n-1)*x,(2)Power = x习题8一、单选题1.B 2.D 3.D 4.A 5.B 6.D 7.A8.(1)D,(2)D 9.B 10.A 11.D二、填空题1. Get, Put2.(1) Open "Myfile3.txt" For Output(2) Write #1, StNo, StMb (3) Close #13. (1) Open " Myfile3.txt" For Input As #1 (2) EOF(1)(3) Input #1, StNo, StMb习题9单选题1.B 2.D 3.D 4.B 5.A 6.A习题10一、单选题1.C 2.(1)A,(2)C 3.C 4.A 5.(1)A,(2)D 6.A 7.D 8.B 9.D二、填空题1.(1)Change,(2)Value,(3)Scroll,(4)Value2.Circle(Scale.Width/2,Scale.Height/2),10003.(1) P1.Picture ,(2) P2.Picture,(3) P2.Picture = P3.Picture4.KeyDown,KeyPress,KeyUp 5.MouseDown,MouseUP6.菜单编辑器,顶;PopUpMenu7.(1) Button.Index (2) BackColor = RGB(255, 0, 0)(3) BackColor = RGB(0, 255, 0) (4) BackColor = RGB(0, 0, 255)8.(1)DragMode, (2)1,(3)0 9.(1)Action, (2)4, (3)ShowFont10.(1)KeyPress, (2)Cls, (3)CurrentY = Y, (4) Button=1习题11一、单选题1.C 2.C 3.A 4.D 5.A 6.D 7.D 8.C9.D 10.D 11.C 12.A 13.B二、填空题1.Select 职工号,基本工资 From 工资表 Where 基本工资>5002.Update 职工表 Set 姓名="伍小明" Where 职工号="00018"3.Select 学籍表.班号,Avg(成绩表.英语) From 成绩表,学籍表 Where 学籍表.学号=成绩表.学号 Group By 学籍表.班号4.Update 工资表 Set 基本工资=基本工资+1005.Delete From 工资表 Where 基本工资<2006.Insert Into 学籍表(学号,姓名,性别,年龄,班号) Values("951009","林东生","男",20,"31")(完)。

《visual basic程序设计基础》习题参考答案剖析

《visual basic程序设计基础》习题参考答案剖析

《Visual Basic程序设计基础》教材习题参考答案第1章 Visual Basic 6.0程序设计概述一、判断题1.√2.√3.×说明:同类控件(如两个标签)相互重叠,设计时可以设置“置前”、“置后”属性。

4.√5.×6.√7.×8.√9.√10.×11.√12.√13.×14.√15.×16.√17.√18.√19.√20.√二、选择题1. C2. B 3.D 4.C 5.B 6.A 7.D 8.A 9.B 10.A 11.C 12.D三、填空题1.对象、事件2.属性、方法、事件3.控件、屏幕(Screen)4.对象5.Left、Top 6.属性、<对象名>.<属性名>=<表达式> 7.网格8.F o rm19.Load或Initialize或Resize或Activate(自动执行的先后顺序也按此排列)10.Activate、Deactivate四、程序设计题程序1.界面设计参看图10-1、10-2以及表10-1。

表10-1 实例2各控件的主要属性设置过程设计如下:Private sub Form_Click()Command2.Enabled = FalseEen SubPrivate Sub Command1_Click()Label2.Visible = FalseLabel1.Caption = Text1.Text + ": 欢迎使用" + Label1.CaptionText1.Visible = FalseCommand1.Enabled = False: Command2.Enabled = TrueEnd SubPrivate Sub Command2_Click()EndEnd Sub程序2.界面设计略,过程设计如下:Private Sub Command1_Click() '字体变大Form1.FontSize = Form1.FontSize + 3Form1.Cls: Print "欢迎使用VB"End SubPrivate Sub Command2_Click() '字体变小Form1.FontSize = Form1.FontSize - 3Form1.Cls: Print "欢迎使用VB"End SubPrivate Sub Command3_Click() '字体加粗Form1.FontBold = TrueForm1.Cls: Print "欢迎使用VB"End SubPrivate Sub Command4_Click() '字体不加粗Form1.FontBold = FalseForm1.Cls: Print "欢迎使用VB"End Sub运行时,不得连续、过多次单击“字体变小”按钮,因为当FontSize属性值小于0会产生适时错误。

《Visual Basic程序设计基础》习题参考答案

《Visual Basic程序设计基础》习题参考答案

第7章对话框与菜单程序设计一、判断题1.√2.√3.√4.×5.×6.×7.√8.√9.√10.√二、选择题1.D 2.A 3.C 4.C 5.B 6.D 7.A 8.B 9.D 10.B三、填空题1.窗体控制菜单、下拉式菜单、快捷菜单2.ShowFont3.打开文件、另存为、颜色、字体、打印对话框4.工程、部件5.CommonDialog1.Action =3、CommonDialog1.ShowColor6.提示信息、对话框类型、对话框标题7.Click8.工具9.代码窗口、Click 10.相同、正四、程序阅读题程序1. 显示提示信息为“5”、标题为“na的输出结果”、有一个“确定”按钮的消息框。

程序2. 显示提示信息为“您选择了第1项”、标题为“第一项”、有一个“确定”按钮的消息框。

五、程序填空题1.(1)Int(Rnd*100) (2)Str(i) (3)Exit For2.(1)False (2)Date (3)CommonDialog1.Color (4)m1六、程序设计题程序1.界面设计略,过程设计如下:Private Sub Command1_Click()CommonDialog1.ShowOpenList1.AddItem CommonDialog1.FileNameEnd Sub程序2.界面设计略,过程设计如下:Private Sub Command1_Click()CommonDialog1.ShowSaveList1.AddItem CommonDialog1.FileNameEnd Sub程序3.界面设计如图10-9、表10-2所示,过程设计如下:Private Sub Sqr_Click()Shape1.Shape = 1End SubPrivate Sub Rec_Click()Shape1.Shape = 0End SubPrivate Sub Oval_Click()Shape1.Shape = 2End SubPrivate Sub Circle_Click()Shape1.Shape = 3End SubPrivate Sub Rrec_Click()Shape1.Shape = 4End SubPrivate Sub RSqr_Click()Shape1.Shape = 5End SubPrivate Sub Shp_Click()Shape1.FillStyle = 2End SubPrivate Sub Shzh_Click()Shape1.FillStyle = 3End SubPrivate Sub Xiex_Click()Shape1.FillStyle = 4End SubPrivate Sub ShPJ_Click()Shape1.FillStyle = 6End SubPrivate Sub XJ_Click()Shape1.FillStyle = 7End SubPrivate Sub FillColor_Click()CommonDialog1.ShowColorShape1.FillColor = CommonDialog1.ColorEnd SubPrivate Sub Exit_Click()EndEnd Sub第8章文件一、判断题1.×2.√3.×4.√5.√6.×7.√8.×9.√10.√11.×12.×13.√14.×15.×二、选择题1.A 2.C 3.B 4.B 5.A 6.C 7.C 8.B 9.C 10.B 11.D 12.B 13.B三、填空题1.ChDir 2.FileLen 3.Change 4.EOF 5.Line Input四、程序阅读题程序1. y= 1 a= 1 程序2. NO. 1 3 程序3.y= 3 a= 2 NO. 2 4 窗体:36 25 16 9 4 1y= 6 a= 3 NO. 3 7 文件:1 4 9 16 25 36y= 10 a= 4 NO. 4 11程序4. 程序5. 1 程序6. 1窗体上显示内容:20 2 2 1 2文件中内容:4 6 8 10 12 3 3 3 1 2 34 4 4 45 5 5 5 5五、程序填空题1.(1)Dim n As Integer (2)"C:\windows\calc.exe"(3)Output (4)End2.(1)For Output As #2 (2)0 (3)"temp.dat" As "c:\a1.dat"3.(1)Open "e:\dataout.txt" For Output As #1(2)t1 Mod t2 = 0 (3)If flag Then (4)Print coun六、程序设计题程序1.界面设计如图10-10所示,过程设计如下:Dim fn As StringPrivate Sub Drive1_Change()Dir1.Path = Drive1.DriveEnd SubPrivate Sub Dir1_Change()File1.Path = Dir1.PathEnd SubPrivate Sub File1_Click()If Right(File1.Path, 1) = "\" Thenfn = File1.Path + File1.FileNameElsefn = File1.Path + "\" + File1.FileNameEnd IfEnd SubPrivate Sub Command1_Click()Dim yesno As Byteyesno = MsgBox("确认要删除吗?", vbYesNo, "删除文件")If yesno = vbYes Then Kill fnFile1.RefreshEnd Sub程序2.建立4个文本框控件依次输入姓名、出生年月、外语、计算机成绩,按“确认”按钮追加该记录到磁盘文件d:\student.dat。

《计算机程序设计基础》课后练习题参考答案

《计算机程序设计基础》课后练习题参考答案

Private Sub Combo1_ KeyPress (KeyAscii As Integer) If _ (38) B Then For i=0 To Combo1.ListCount-1 If Combo1.Text= _ (39) B Then Label2.Caption="输入项已在组合框中" Exit Sub End If Next i
a(j - 1) = t End If Next j Next i For i = 1 To 5 Print a(i); Next i End Sub (36) A)a(j) <a(j - 1) B)a(j) > a(j - 1) C)a(i) > a(j) D)a(j)> a(i) (37) A)a(i)=a(j) B) a(j-1)=a(j) C)a(j)=a(i) D) a(j) = a(j - 1) 【程序填空4】在窗体上画一个名称为Combol的组合框,画两个名称分 别Label1和Label2及Caption属性分别为“城市名称”和空白的标签。程序 运行后(如下图所示),当在组合框中输入一个新的项目按回车键时 (回车键的ASCII码为13),如果输入的项在组合框的列表中不存在, 则自动添加到组合框的列表中,并在Label2中给出提示“已成功添加输 入项;如果存在,则在Label2中给出提示“输入项已在组合框中”。
A)BOF B)LOF C)LEN D)EOF 3. 程序填空题 【程序填空1】在C盘当前文件夹下已存在名为Data.txt的文件,利用文 本框(Text1)输入若干英文单词。要求每输入一个单词后,按下回车 键将文本框中的单词写入文件,然后清除文本框的内容以便输入下一个 单词。当在文本框中输入的单词是“END”时,则表示结束输入(对于 单词“END”不论大小写都视为结束),最后将文件关闭。 Private Sub Form_Load() (31) A Text1.Text = "" End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If (32) D = "END" Then Close # End Else (33) A(注意,Text1的默认属性为text,可省略 不写) Text1.Text = "" End If End If End Sub (31) A)Open "C:\Data.txt" For Output As #1 B)Open "C:\Data.txt" For Input #1 C)Open "C:\Data.txt" Input As #1 D)Open "C:\Data.txt" Output As #1 (32) A)LCase(Text1.Text) B)Text1.Text C)Str(Text1) D)UCase(Text1.Text) (33) A)Write #1, Text1 B)Write #1, Text C)Write #3, Text1.Text D)Write #1, Text.Text 【程序填空2】程序运行后如下图所示,Label1的Caption显示为 "字体定 时变大",影响字体大小的属性每隔0.5秒增加1,数值在[8,72]之间变 化。

Visual Basic 程序设计教程习题答案

Visual Basic 程序设计教程习题答案

(4)I <= N
3. (1)K
(2)Flag = 0
4. (1)B
(2)D
(3)A
(4)B
(5)C
5. (1)C
(2)B
(3)A
6. (1)A()
(2)N
(3)I+1
(4)A(J)
(5)T
7. (1)ReDim A(N) (2)P>N Or P<1 (3)P+1
(4)D
8. (1)YO < Y(I)
666666
7777777
22. 1
23. 10 5
24. I= 7
A= 11
25. M1= 120
M2= 6
26. 3 21
27. 2 4 -3 3
28. 11
29. 14 6 3
30.
*
***
*****
*******
*********
***********
31. *****
****
***
**
*
5. A( 17.4 )
6. -1
7. he
is
ang
8. 1 2 False
9. 123321
10. 444
11. -3 3
12. 30 10
13. False
14. I= 2
15. I= 1
16. A
17. **0**
18. 7 22
19. 2 3 5
20. 1 6
21.
1
22
333
4444
55555
四、写出下列条件对应的 Visual Basic 关系表达式或布尔表达式。
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

第一章程序与编程环境一、填空题1. 工程,Form_Load2. 事件(触发)3. 窗体,Name4. CurrentX, CurrentY5. maxButton, BorderStyle = 1 or 3 or 4 or 56. Alignment, 空缺,AutoSize7. Style, LoadPicture8. Line, Shape9. 重画10. FillStyle ll. MultiLine, maxLength, Locked 12. Font13. sub, 对象名,事件名14. 方法,Object.Method, text1.setfocus()15. Name, minButtom, CurrentX(Y), Caption16. Interval, Enable 17. timer, Interval, ms(毫秒)18. Mouse Down, Click, LoastFocus19. .Frm, .Frx, .bas. cls. Vbp 20. 注释, “Rem 语句”或者“’语句”第二章数据的类型、表示以及运算一、请指出下列哪些是VB的合法常量,并说明原因(1)√(2)X 常量不能加类型说明符号改成123.4 (3)X与上题类似,如果是常量,则类型说明符放在后面(4)√等价于2E3 (5) √(6)√等于十进制的4113(7)X 如果是16进制要写&符号(8)X 指数不能为小数(9)X 月份超过12,日超过31 (10)√(11)√(12)√等价于上一题(13)X 8进制数每一位不能超过8 (14)√(15)X 变量,常量要为基本数据类型的值(16)√二、找出合法变量(1)√(2)√如果与控件Label1同在一个应用程序里面,该变量会屏蔽掉控件Label1(3) X 保留字(4)√(5)X 变量不能以数字开头(6)变量不能有小数点(7)√(8)√数组变量(9)X保留字(10)√可以,但rnd()不可以,rnd()是函数 (11) √(12)√(13)√(14)X ’符号表示注释(15)X 这是表达式,不是变量(16)X 同上,是表达式三、指出下列数据x,y,z的声明是否正确,如果正确请指明其类型(1)√ x--long, y—variant, z—integer(2) √ x—long, y—long, z—integer(3) √ x—double, y—double, z—integer(4) X 变量x &中间不能有空格(5)√自动转换成字符串(6)X 变量声明不能直接赋值(7)√(8)√自动转换成字符串(9)X 常量不能把函数写上去(10)√四、写出下列表达式的结果(1)1 (2) 1 (3)false (4) ab12 (5)123 (6)出错,加法表达式中如果有一个是数值类型,则“+”表示加号,而不是字符的链接符号(7)False (8)true (9) true (10) false 默认转换成相同类型(数值),建议这里把2改成D试试(P.S. 布尔类型TRUE = -1, FALSE = 0;优先顺序:^(乘方)→-(求负)→*、/→\(整除)→MOD→+、-)五、写出下列函数的结果(1)3 (2)2 (3)-2 (4)0 (5)2 (6)23 (7)23 (8)1 (9)1 (10)21 日期差分函数,参数“m”为两年月份之差六、写出满足以下条件的表达式(1)fix(rnd()*90)+10 (2)chr(fix(rnd()*26)+65) (3) (A mod 100)\10(4) A mod B<>0 (5)A>“A”and A<“Z”(6) A<B OR A<C (7)A>C AND B>C(8) (A>C AND B<C) OR (A<C AND B>C) (9) A+B>C AND B+C>A AND C+A>B(10)A=“及格”XOR B=“及格”(11)Round(A/B,2) (12) Len(A)<>0 或 Len(A)>0(13) “A10?”(14) Len(A)>=3七、填空题1. “”, # #2. x>=10 and x<203. (y mod 3=0) or (y mod 7 =0)4. sin(x)^2 + (1/2)*sqr(x^2-y^2)5. 166. T, F7. SIN(ATN(1))8. Randomize9. (c>chr(97) and c<chr(122)) or (c<chr(48) and c>chr(57))10. vbCrLf 11. CInt(), 012. 从第12个月开始,循环一年12个月13. ab, cd0 14. Variant, String, Integer15. Now() 16. DateDif(#2011-5-1#,now(), “m”)八、请指明下列程序运行后,各个变量的值(1) 3 5(2) 120(3) False(4) -3九、分析下面程序中的错误并修改,使其能够完成指定的功能(1)Print 20000+0&+20000或 Print 20000&+20000&(2) 改1:A=xA= a+aB=xB=2*b改2:A=a+x+xB=2*(x+b)第三章程序界面与基本输入输出一、填空题1.Textbox, Inputbox, Label, Textbox, Msgbox, Print2. “,” , “;” , CurrentX, CurrentY3. Print4. AutoSize, Stretch5. Textbox, Label, Textbox, True6. Text1=””, Picture1.cls7. Integer, String8. Textbox, Check , Option, Combo, List9. .setFocus, 失去焦点10. Min, Max, Scroll, Change11. TabIndex12. Enabled, Visible第4章控制结构一、判断题1.X2. X3. √4. X 循环体中改变其值5.√二、填空题1. 顺序,选择,循环2. “A”,”E”, chr(97), “A” to “Z”, Is>0, Else3. 死循环4. 设置计数器5. True/False, 0/16. 0, ListCount-1三、读程序填空1. 88 及格2. Print x; “是偶数”Print x; “是奇数”3.i= Instr(st, “”)right(st, len(st)-i)I = Instr(st, “The”)Left(st, i-1) & right(st, len(st)-i-3)不用填任何东西(这里是旧版书的过程返回)4.is < 0 “无定义”0 to 1 (log(x)/log(2))^2Is >1 sqr(log(x)/log(2))5.40 ,176.*fAbs(x2-x1)<0.000017. while m<>nPrint m (或n)第5章数组和自定义类型一、简答题1.Option Base 1, 只能取0或12.很多情况3.动态数组可重定义,静态数组不可以;动态数组可以用变量,静态数组不可以用变量4.不能,Preserve关键字保留数组原有的内容,但是只能够改变数组的最后一维5.将用引号分隔的字符串塞进数组;UBound(), LBound()在不确定数组上下界情况下可使用或写出的程序更通用6.8字节7.6个元素;[0,2] [3,4]8.这里较为特殊的是List框的Text属性,就是List框所选的内容9.组合框=文本框+列表框;组合框可以输入,列表框不可以;组合框无多选,列表框可以10.自定义类型还没有在内存中分配变量,而自定义变量则是在内存中分配了变量。

(P84)5.6二、指出下列有关数组语句的错误1.Dim a%(10) 或Dim a(10) as Integer2.下界溢出,边界顺序颠倒3.多维数组立面的每一维上界不能为负数4.Option Base 15.静态数组,下标不能是常量6.动态数组重定义只能与声明时的类型相同7.动态数组没有重定义就直接使用8.静态数组不可以重定义9.动态数组用Preserve关键字重定义,只能改变数组的最后一维的大小10.用Array赋值,只能是动态数组11.数组a的类型为字符串,应改为:a$()12.数组重1开始,越界三、写出下面程序的输出结果(1)输出: 14916253649 (2)输出:1 2 32 3 13 2 3 (3)输出:6 12 (4)输出:25 (5)输出:1 2 34 69 (6)输出:21四、程序填空(1)①Rnd()*90+10 ②i+1 to 30 ③a(i)=a(j) ④I mod 2<>0 (2)①Rnd()*90+10 ②arr(i)>50 ③sum+arr(i)(3)①39 to 1 step -1 ② 1 to 40 ③mod(4)①Preserve a(n+1) ②a(i+1)=a(i) ③a(i+1)=m(5)①10 ②10 ③a((i-1)*10+j)(6)①A(i,j) ②A(5-i+1, 5-j+1) ③A(5-i+1,5-j+1) = temp 第6章过程一、简答题1.函数有返回值,过程没有2.形参为定义函数(过程)时的参数;实参为运行函数(过程)时的实际参数3.ByVal创建副本,ByRef不创建副本4.数组只能传地址5.局部、模块级、全局6.静态:生命周期是全局的局部变量,生命周期比普通局部变量要长二、指出下列有关过程声明语句的错误1.X 将保留字Sub作为函数名。

改正:Function sub1%()2.X 生命重复,参数名与函数名一样,编译器分不清哪个是参数,哪个是函数返回值。

改正:Function f%(para%)3.X 过程不应该有返回值。

改正:Sub f()4.X 数组必须为按地址传递,过程不应该有返回值。

改正:Sub f(a%())5.数组参数必须传首地址。

改正:Sub f(a%())三、写出单击命令按钮后下面程序运行结果1.输出:2 342.输出:2533.输出:A=4 b=6 c=6A=8 b=6 c=6 4.输出:357455.输出:3 12 3 6.输出:2 4 6 8四、程序填空1.①flag = -1 ②y + flag * t ③t <= 0.0000001 ④n as Integer ⑤n, x-12. ①n \ 2 ②b(n-i+1) ③a(), 103. ①IsP = True②m mod i = 0 ③P1 and P2 ④IsP(i)(P.S. 这里漏了一段程序IsP()函数)Public Function IsP(m%) as BooleanDim i%IsP = TrueFor I =2 to Int(sqr(m))If m mod I = 0 Then IsP = FalseNext iEnd Function4.①Tag ②t = a(0) ③UBound(A)-1 ④a(j) = t⑤t = A(UBound(A)) ⑥LBound(A)+1 step -1 ⑦a(j) = t第7章外存数据的访问一、填空题(1)Output(2)打开text.txt读入内存(3)Open “c:\test.doc” for Input as #1Open “c:\test.doc” for Append as #1(4)Open fr & “\” & “test.txt” for Input as #1(5)FreeFile()(6)Close, Kill, FileCopy(7)Kill “c:\*.bat”(8)FileCopy “C:\Form1.frm”, “C:\复件Form1.frm”(9)“””, “#”, (无), “,”二、读程序填空(1)①Text = “End”②Write #1, Text (带格式) 或Print #1, Text (不带格式)(2)①k<5 ②s=s+input(1,#1) ③s(3)①for Input as #1 ②Input(Lof(1),#1) ③Close #1④for Output as #1 ⑤Print #1, “Begin”⑥Print #1, s三、简答题(1)顺序读写、随机读写(2)对应文件(外存)的一个缓冲区(内存)句柄,读写文件入口,不可省略(3)Wirte 有格式,Print 无格式(4)可以(5)用Close关闭文件,将缓冲区数据写入文件第8章对话框与菜单的设计一、填空题1. 预定义对话框,通用对话框,自定义对话框2. CommonDialog3. ShowOpen, ShowSave, ShowColor, ShowFont, ShowPrint, ShowHelp4. “-”5. 56. Hide, Unload7. ShowModel 8. ShowColor二、判断题1. √2. X3.X4.X5. √三、读程序填空1. ①showSave ②CommonDialog1.Filename③now(), CommonDialog1.Filename2. ①“窗体文件|*.frm|VB工程文件|*.vbp”②13. ①Form2.Text1 ②Unload Form2第9章绘图一、填空题1. ScaleHeight, ScaleWidth2. DrawWidth3. B, F4. 300, 520二、判断题1. √2. √3. X4. √5. √6. √7. √。

相关文档
最新文档