ImageVerifierCode 换一换
格式:DOCX , 页数:57 ,大小:24.62KB ,
资源ID:12277992      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/12277992.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(VB程序设计教程第3版课后实验答案.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

VB程序设计教程第3版课后实验答案.docx

1、VB程序设计教程第3版课后实验答案实验AA1Private Sub Command1_Click() Label3 = Text1End SubA2Private Sub Form_Load() Timer1.Interval = 0End SubPrivate Sub Command1_Click() 自动 Timer1.Interval = 200End SubPrivate Sub Command2_Click() 手动 Timer1.Interval = 0 Call MyMoveEnd SubPrivate Sub Timer1_Timer() Call MyMoveEnd SubS

2、ub MyMove() Label1.Move Label1.Left - 50 If Label1.Left 0 Then Label1.Left = Form1.WidthEnd SubA3Private Sub Form_Click() Text1 = Val(Text1) + 1End SubPrivate Sub Form_Load() Text1 = 0End SubA4Private Sub Form_Click() Caption = 单击窗体,改变图片 Picture = LoadPicture(App.Path + n_015.bmp) Print 欢迎使用VBEnd Su

3、bPrivate Sub Form_DblClick() Cls Caption = 双击窗体,卸去图片 Picture = LoadPicture() End SubPrivate Sub Form_Load() Caption = 装入窗体 Picture = LoadPicture(App.Path + n_016.bmp) Print 装入图End SubPrivate Sub Form_Resize() 该事件的作用窗体始终与图一样大 Caption = 窗体大小不变 Form1.Width = 260 * 16 260是Tongji-2.bmp图的宽度,象素单位 Form1.Hei

4、ght = 260 * 16 + 200 260是图的高度,象素单位,200是窗体的标题栏高度End SubA5Sub Command1_Click() Text1.FontName = 隶书 Text1.FontSize = 25End SubSub Command2_Click() Text2.Text = Text1.SelText Text2.FontName = Text1.FontName Text2.FontSize = Text1.FontSizeEnd Sub实验BB1Private Sub Command1_Click() Text2 = Format(5 / 9 * (V

5、al(Text1) - 32), 0.00)End SubPrivate Sub Command2_Click() Text1 = Format(9 / 5 * Val(Text2) + 32, 0.00)End Sub或Private Sub Command1_Click() Dim f!, c! 声明两个变量 f = Val(Text1) c = 5 / 9 * (f - 32) Text2 = Format(c, 0.00) 保留两位小数End SubPrivate Sub Command2_Click() Dim ff!, cc! 声明两个变量 cc = Val(Text2) ff =

6、 9 / 5 * cc + 32 Text1 = Format(ff, 0.00) 保留两位小数End SubB2Private Sub Command1_Click() Label2 = Format(Val(Text1) * Val(Text1) * 3.14, 0.00)End SubPrivate Sub Command2_Click() Label3 = Format(Val(Text1) * 3.14 * 2, 0.00)End SubPrivate Sub Text1_LostFocus() If Not IsNumeric(Text1.Text) Then MsgBox 输入有

7、非数字字符,请重新输入, , 警告 Text1.Text = Text1.SetFocus End IfEnd Sub或Private Sub Command1_Click() Label2 = Format(Val(Text1) * Val(Text1) * 3.14, 0.00)End SubPrivate Sub Command2_Click() Label3 = Format(Val(Text1) * 3.14 * 2, 0.00)End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then I

8、f Not IsNumeric(Text1.Text) Then Text1.Text = End If End IfEnd SubB3Private Sub Command1_Click() n = Int(Log(2) / Log(1.008) + 1) Label1 = n & 年后人数超过26亿End SubB4Private Sub Command1_Click() Dim x, dx, cd x = Text1.Text dx = UCase(x) cd = Len(x) Print 大写字母为:; dx Print 字符串长度为:; cdEnd SubB5Private Sub

9、Command1_Click() Text1 = Int(Rnd * 900 + 100)End SubPrivate Sub Command2_Click() Dim x%, x1%, x2%, x3% x = Val(Text1) x1 = x Mod 10 分离出的个位数 x2 = (x Mod 100) 10 分离出的十位数 x3 = x 100 分离出的百位数 Label1 = x1 * 100 + x2 * 10 + x3End SubB6Private Sub Form_Click() Label1 = Left(Text1, 11) Label2 = Mid(Text1, 12

10、, 6) Label3 = Right(Text1, 5)End SubB7Private Sub Command1_Click() Print For i = 1 To 5 Print Tab(15 - i * 2); String(2 * i - 1, ); Spc(18 - 4 * (i - 1); String(2 * i - 1, ) Next iEnd SubPrivate Sub Command2_Click() ClsEnd Sub进一步要求:Private Sub Command1_Click() Print For i = 1 To 5 Print Tab(15 - i *

11、 2); String(2 * i - 1, ); String(10 - (2 * i - 1), ); String(2 * i - 1, ) Next iEnd SubPrivate Sub Command2_Click() ClsEnd SubB8Private Sub Form_Click()x = Val(InputBox(输入一正实数, 计算, 0)pf = Format(x * x, 0.000)pfg = Format(Sqr(x), 0.000)lf = Format(x * x * x, 0.000)lfg = Format(x (1 / 3), 0.000)Print

12、平方为:; pf; Space(5); 平方根为:; pfg; Space(5); 立方为:; lf; Space(5); 立方根为:; lfgEnd Sub实验CC1Private Sub Form_Click()Dim x!, y!x = Val(InputBox(输入x的值)If x 1000 Theny = xElseIf x 2000 Theny = 0.9 * xElseIf x 3000 Theny = 0.8 * xElsey = 0.7 * xEnd IfPrint yEnd SubC2Private Sub Form_Click()Dim x!, y!x = Val(Inp

13、utBox(输入上网时间)If x 10 Theny = 30ElseIf x 150 Theny = 150End IfPrint yEnd SubC3Private Sub Command1_Click() Dim x!, y!, z! x = InputBox(input x) y = InputBox(input y) z = InputBox(input z) Print x y z Print 排序前; x; ; y; ; z If x y Then t = x: x = y: y = t If x z Then t = x: x = z: z = t If y z Then t

14、= y: y = z: z = t Print 排序后 & x & & y & & zEnd SubPrivate Sub Command2_Click() Dim x!, y!, z! x = InputBox(input x) y = InputBox(input y) z = InputBox(input z) Print x y z Print 排序前; x; ; y; ; z If x y Then t = x: x = y: y = t If y z Then t = y: y = z: z = t If x a(i + 1) Thenz = a(i + 1)a(i + 1) =

15、a(i)a(i) = zEnd IfNext iPicture2.Print a(0)Picture2.Print a(1)Picture2.Print a(2)End SubC5Private Sub Text2_LostFocus() Dim m%, n%, y% m = Val(Text1) n = Val(Text2) If n Mod 2 0 Then MsgBox (脚数必定为偶数) Text2 = Text2.SetFocus Else y = n / 2 - m If y 0 Then Text4 = Format(-b + Sqr(de) / t, 0.00) Text5 =

16、 Format(-b - Sqr(de) / t, 0.00)Else Text4 = Format(-b / t, 0.00) & + & Format(Sqr(Abs(de) / t, 0.00) & i Text5 = Format(-b / t, 0.00) & - & Format(Sqr(Abs(de) / t, 0.00) & iEnd IfEnd SubPrivate Sub Command2_Click()Text1 = Text2 = Text3 = Text4 = Text5 = End SubC7Private Sub Text3_LostFocus() Select

17、Case Trim(Text3) Case + Text4 = Val(Text1) + Val(Text2) Case - Text4 = Val(Text1) - Val(Text2) Case * Text4 = Val(Text1) * Val(Text2) Case / If Val(Text2) = 0 Then MsgBox 分母为零,重新输入 Text2 = Text2.SetFocus Else Text4 = Val(Text1) / Val(Text2) End If End SelectEnd SubC8Private Sub Text1_LostFocus() Sel

18、ect Case Trim(Text1) Case 1 Text2 = Monday Case 2 Text2 = Tuesday Case 3 Text2 = Wednesday Case 4 Text2 = Thursday Case 5 Text2 = Friday Case 6 Text2 = Saturday Case 7 Text2 = Sunday Case Is 7, Is 7 Or Text1 1 Then MsgBox 数字为17,重新输入 Text1 = Text1.SetFocusElse Text2 = Choose(Text1, Monday, Tuesday, W

19、ednesday, Thursday, Friday, Saturday, Sunday)End IfEnd Sub实验DD1Private Sub Form_Click() For i = 1 To 9 Print Tab(10 - i); String(2 * i - 1, Trim(Str(i) Next iEnd SubD2Private Sub Form_Click() For i = 1 To 10 Step 1 Print Tab(i); String(20 - 2 * i), Chr(64 + i) Next iEnd SubD3Private Sub Command1_Cli

20、ck()Dim s!, t!, i&s = 1t = 1For i = 1 To 100000t = t + is = s + 1 / tIf 1 / t 0.00001 Then Exit ForNext iPrint For结构; s, i; 项End SubD4Private Sub Command1_Click()Dim n&, pi#, i&n = InputBox(输入n值)pi = 2For i = 1 To n pi = pi * (2 * i) / (2 * i - 1) * (2 * i) / (2 * i + 1)Next iPrint 当n= & n & 时,pi=;

21、piEnd SubD5Private Sub Form_Click() Dim s!, t!, i!, a%, n% a = Int(Rnd * 9 + 1) n = Int(Rnd * 6 + 5) t = 0: s = 0 Print a=; a, n=; n For i = 1 To n t = t * 10 + a s = s + t Print t; Next i Print Print s=; sEnd SubD6Private Sub Command1_Click()Dim s As Integers = 0For i = 1 To 9 For j = 0 To 9 For k

22、= 0 To 9 s = i * 100 + j * 10 + k If s = i 3 + j 3 + k 3 Then Print s End If Next k Next jNext iEnd SubPrivate Sub Command3_Click()formd6.Hidemain.ShowEnd SubD7Private Sub Command1_Click() Dim a!, x0!, x1! a = 27 x0 = 2 i = 0 Do i = i + 1 x1 = 2 * x0 / 3 + a / (3 * x0 * x0) If Abs(x1 - x0) Max Then

23、Max = a(i) If a(i) Min Then Min = a(i) Avg = Avg + a(i) Next i Avg = Avg / 10 Print Print Max=; Max; Min=; Min; Avg=; AvgEnd SubE2Private Sub Form_Click() Dim a a = Array(56, 78, 98, 88, 76, 78) For i = 0 To 5 Print String(a(i) 5, ); a(i) Print Next iEnd SubE3Dim a%(19)Private Sub Command1_Click()Picture1.Cls For i = 0 To 19 a(i) = Int(Rnd * 101) Picture1.Print a(i); ; If (i + 1) Mod 4 = 0 Then Picture1.Print Next iEnd SubPrivate Sub

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1