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

内容发布更新时间 : 2024/5/6 23:17:40星期一 下面是文章的全部内容请认真阅读。

Width = 2415 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 = InputBox(\请输入弧度数值\弧度转换\ xx = Val(x)

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

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

c = (b - bb) * 60

cc = Format(c, \

MsgBox \弧度\转换为\度\分\秒\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() Do

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

zongfei = zongfei & Space(3) & fei MsgBox zongfei, , \上网费用为\ Else

Exit Do End If Loop

End Sub

Private Sub Command2_Click() End End Sub

实验5

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() For n = 1 To 100 s = s + n Next n Print s 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 = 1920 TabIndex = 0 Top = 1680 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() For i = 0 To 20 For j = 0 To 33

If i * 5 + j * 3 + 1 / 3 * (100 - i - j) = 100 Then Print i, j, 100 - i - j Next Next 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() n = 0 Do

If n Mod 2 = 1 And n Mod 3 = 2 And n Mod 5 = 4 And n Mod 6 = 5 And n Mod 7 = 0 Then Exit Do n = n + 1

Loop Print n 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 Command2 Caption = \方法2\ Height = 495 Left = 2880 TabIndex = 1 Top = 1320 Width = 1215 End

Begin VB.CommandButton Command1 Caption = \方法1\ Height = 495 Left = 2880 TabIndex = 0 Top = 480 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%, i%, j% For x = 0 To 9 For y = 0 To 9 For z = 0 To 9

i = x * 100 + x * 10 + z j = y * 100 + z * 10 + z

If i + j = 532 Then Print x; y; z