⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm3.3.frm

📁 利用rnd产生随机数
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmd2 
      Caption         =   "下一题"
      Height          =   375
      Left            =   2880
      TabIndex        =   7
      Top             =   2400
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查看"
      Height          =   375
      Left            =   1320
      TabIndex        =   6
      Top             =   2400
      Width           =   855
   End
   Begin VB.Frame fra 
      Caption         =   "Frame1"
      Height          =   1455
      Left            =   360
      TabIndex        =   0
      Top             =   600
      Width           =   3975
      Begin VB.TextBox txt 
         Height          =   375
         Left            =   2760
         TabIndex        =   5
         Top             =   480
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "="
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2520
         TabIndex        =   4
         Top             =   480
         Width           =   255
      End
      Begin VB.Label lbl3 
         BorderStyle     =   1  'Fixed Single
         Height          =   375
         Left            =   1560
         TabIndex        =   3
         Top             =   480
         Width           =   735
      End
      Begin VB.Label lbl2 
         Height          =   375
         Left            =   960
         TabIndex        =   2
         Top             =   480
         Width           =   495
      End
      Begin VB.Label lbl1 
         BorderStyle     =   1  'Fixed Single
         Height          =   375
         Left            =   240
         TabIndex        =   1
         Top             =   480
         Width           =   615
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim n As Integer
Dim sum As Integer
Dim a As Integer

Private Sub Form_Load()
Dim b As Integer
n = n + 1
fra.Caption = "第" & n & "题"

lbl1.Caption = Int(Rnd * 3) + 9
lbl3.Caption = Int(Rnd * 3) + 5
b = Int(Rnd * 4)
Select Case b
Case 0
lbl2.Caption = "-"

a = lbl1.Caption - lbl3.Caption

Case 1
lbl2.Caption = "+"
a = lbl1.Caption + lbl3.Caption


Case 2
lbl2.Caption = "*"
a = lbl1.Caption * lbl3.Caption

Case 3
lbl2.Caption = "\"
a = lbl1.Caption \ lbl3.Caption

End Select
End Sub



Private Sub Command2_Click()

End Sub

Private Sub cmd2_Click()
If a = Val(txt.Text) Then
sum = sum + 5
End If

lbl1.Caption = ""
lbl2.Caption = ""
lbl3.Caption = ""
txt.Text = ""
Form_Load


End Sub

Private Sub Command1_Click()
j = MsgBox("你的成绩是:" & sum & "分,是否再测一次?", vbYesNo + vbQuestion, "结果")

If j = vbNo Then
    End
Else
Form_Load
End If


End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -