VisualBasic程序设计—实验报告册-参考答案 下载本文

内容发布更新时间 : 2024/5/7 11:34:06星期一 下面是文章的全部内容请认真阅读。

Weight = 700

Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty

LinkTopic = \ ScaleHeight = 4305 ScaleWidth = 6345

StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command1 Caption = \转换\ Height = 495 Left = 2160 TabIndex = 2 Top = 1800 Width = 1455 End

Begin VB.TextBox Text1 Height = 495 Left = 3480 TabIndex = 1 Top = 720 Width = 1455 End

Begin VB.Label Label2 Height = 975 Left = 360 TabIndex = 3 Top = 2760 Width = 5775 End

Begin VB.Label Label1

Caption = \请输入弧度数值:\ Height = 495 Left = 600 TabIndex = 0 Top = 720 Width = 2415 End End

Attribute VB_Name = \

Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False Option Explicit

Private Sub Command1_Click()

Dim x!, a!, aa%, b!, bb%, c!, cc$ x = Val(Text1)

a = x * 180 / 3.14 aa = Int(a)

b = (a - aa) * 60 bb = Int(b)

c = (b - bb) * 60

cc = Format(c, \

Label2 = \弧度\转换为\度\分\秒\

End Sub

VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 3255 ClientLeft = 60 ClientTop = 450 ClientWidth = 4980 LinkTopic = \ ScaleHeight = 3255 ScaleWidth = 4980

StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command1 Caption = \判断\ Height = 495 Left = 1560 TabIndex = 2 Top = 1440 Width = 1335 End

Begin VB.TextBox Text1 Height = 615 Left = 960 TabIndex = 0 Top = 600 Width = 2655 End

Begin VB.Label Label2 Height = 735 Left = 960 TabIndex = 3

Top = 2160 Width = 2775 End

Begin VB.Label Label1

Caption = \输入一个年份:\ Height = 375 Left = 1320 TabIndex = 1 Top = 240 Width = 1935 End End

Attribute VB_Name = \

Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() Dim x%

x = Val(Text1)

If x / 400 = x \\ 400 Or x Mod 4 = 0 And x Mod 100 <> 0 Then Label2 = Text1 & \年是闰年\ Else

Label2 = Text1 & \年不是闰年\End If End Sub

VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 3090 ClientLeft = 60 ClientTop = 450 ClientWidth = 4680 LinkTopic = \ ScaleHeight = 3090 ScaleWidth = 4680

StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command1 Caption = \个数排序\ Height = 495 Left = 1800 TabIndex = 0 Top = 1320 Width = 1215

End End

Attribute VB_Name = \

Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False

Private Sub Command1_Click() Dim x%, y%, z%

x = InputBox(\输入第一个数\ y = InputBox(\输入第二个数\ z = InputBox(\输入第三个数\

If x > y Then t = x: x = y: y = t If y > z Then t = y: y = z: z = t If x > y Then t = x: x = y: y = t Print x, y, z End Sub

VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 5430 ClientLeft = 60 ClientTop = 450 ClientWidth = 6975 LinkTopic = \ ScaleHeight = 5430 ScaleWidth = 6975

StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command2 Caption = \结束\ Height = 495 Left = 3840 TabIndex = 1 Top = 2040 Width = 1215 End

Begin VB.CommandButton Command1 Caption = \计费\ Height = 495 Left = 1080 TabIndex = 0 Top = 2040 Width = 1215

End End

Attribute VB_Name = \

Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click()

x = Val(InputBox(\请输入上网时间:\ If x <> -1 Then Select Case x Case Is < 10 fei = 25 Case 10 To 50 fei = x * 2 Case 50 To 100 fei = x * 1.5 Case Is >= 100 fei = x * 1 End Select

MsgBox \上网费用为:\元\ End If End Sub

Private Sub Command2_Click() End End Sub

VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 4050 ClientLeft = 60 ClientTop = 450 ClientWidth = 6285 LinkTopic = \ ScaleHeight = 4050 ScaleWidth = 6285

StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command1

Caption = \弧度转换为度分秒\ Height = 615 Left = 2160 TabIndex = 0 Top = 1560