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

内容发布更新时间 : 2024/12/23 13:49:36星期一 下面是文章的全部内容请认真阅读。

Height = 495 Left = 3840 TabIndex = 1 Top = 1800 Width = 1215 End

Begin VB.CommandButton Command1 Caption = \方法一\ Height = 495 Left = 3840 TabIndex = 0 Top = 600 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%

x = Int(Rnd * 900 + 100) Print \产生的随机数:\

y = (x Mod 10) * 100 + (x \\ 10 Mod 10) * 10 + x \\ 100 Print \反序数:\End Sub

Private Sub Command2_Click() Dim x%, y As String

x = Int(Rnd * 900 + 100) Print \产生的随机数:\ y = Trim(Str(x))

Print \反序数:\End Sub

Begin VB.Form Form1

Caption = \ ClientHeight = 4275 ClientLeft = 60 ClientTop = 345 ClientWidth = 6975 LinkTopic = \ ScaleHeight = 4275

ScaleWidth = 6975

StartUpPosition = 3 '窗口缺省 Begin VB.TextBox Text2 Height = 615 Left = 4080 TabIndex = 5 Top = 960 Width = 1215 End

Begin VB.CommandButton Command1 Caption = \开始产生\ Height = 495 Left = 2640 TabIndex = 3 Top = 1920 Width = 1215 End

Begin VB.TextBox Text1 Height = 615 Left = 1200 TabIndex = 0 Top = 960 Width = 1215 End

Begin VB.Label Label3

Caption = \ Height = 375 Left = 840 TabIndex = 4 Top = 2880 Width = 4695 End

Begin VB.Label Label2

Alignment = 2 'Center Caption = \到\ BeginProperty Font

Name = \隶书\ Size = 15 Charset = 134 Weight = 700

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

Height = 375 Left = 2760 TabIndex = 2 Top = 1080 Width = 975 End

Begin VB.Label Label1

Caption = \输入随机数范围:\ BeginProperty Font

Name = \隶书\ Size = 14.25 Charset = 134 Weight = 700

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

Height = 495 Left = 480 TabIndex = 1 Top = 360 Width = 2655 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 m%, n% Randomize

m = Val(Text1): n = Val(Text2) x = Int(Rnd * (n - m) + m) y = Int(Rnd * (n - m) + m) z = Int(Rnd * (n - m) + m) Label3 = m & \到\& n & \之间的3个随机数为: \& z

End Sub

VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 3270

& x & Space(3) & y & Space(3) ClientLeft = 60 ClientTop = 450 ClientWidth = 6000 LinkTopic = \ ScaleHeight = 3270 ScaleWidth = 6000

StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command3 Caption = \星期几\ Height = 495 Left = 360 TabIndex = 2 Top = 2280 Width = 1455 End

Begin VB.CommandButton Command2 Caption = \时间\ Height = 495 Left = 360 TabIndex = 1 Top = 1440 Width = 1455 End

Begin VB.CommandButton Command1 Caption = \日期\ Height = 495 Left = 360 TabIndex = 0 Top = 600 Width = 1455 End

Begin VB.Label Label3

BorderStyle = 1 'Fixed Single Caption = \ Height = 495 Left = 2520 TabIndex = 5 Top = 2280 Width = 2535 End

Begin VB.Label Label2

BorderStyle = 1 'Fixed Single Caption = \ Height = 495

Left = 2520 TabIndex = 4 Top = 1440 Width = 2535 End

Begin VB.Label Label1

BorderStyle = 1 'Fixed Single Caption = \ Height = 495 Left = 2520 TabIndex = 3 Top = 600 Width = 2535 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() Label1.Caption = Date End Sub

Private Sub Command2_Click() Label2.Caption = Time End Sub

Private Sub Command3_Click()

Label3.Caption = WeekdayName(Weekday(Date)) End Sub

实验4

VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 4305 ClientLeft = 60 ClientTop = 450 ClientWidth = 6345 BeginProperty Font

Name = \宋体\ Size = 14.25 Charset = 134