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

📄 form0609.frm

📁 VB实验教程源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "计算兔子数"
   ClientHeight    =   2940
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4260
   LinkTopic       =   "Form1"
   ScaleHeight     =   2940
   ScaleWidth      =   4260
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   495
      Left            =   1440
      TabIndex        =   6
      Top             =   2160
      Width           =   1455
   End
   Begin VB.TextBox Text2 
      Alignment       =   2  'Center
      Height          =   495
      Left            =   1560
      TabIndex        =   3
      Top             =   1200
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Alignment       =   2  'Center
      Height          =   495
      Left            =   1560
      TabIndex        =   0
      Top             =   240
      Width           =   1335
   End
   Begin VB.Label Label4 
      Caption         =   "对兔子"
      Height          =   375
      Left            =   3000
      TabIndex        =   5
      Top             =   1320
      Width           =   735
   End
   Begin VB.Label Label3 
      Caption         =   "共有"
      Height          =   495
      Left            =   720
      TabIndex        =   4
      Top             =   1320
      Width           =   615
   End
   Begin VB.Label Label2 
      Caption         =   "个月"
      Height          =   375
      Left            =   3120
      TabIndex        =   2
      Top             =   360
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "第"
      Height          =   495
      Left            =   720
      TabIndex        =   1
      Top             =   360
      Width           =   615
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Function Fib(n As Integer)
'子函数计算Fibonacci数列
    If n = 1 Or n = 2 Then
        Fib = 1
    Else
        Fib = Fib(n - 1) + Fib(n - 2)
    End If
End Function

Private Sub Command1_Click()
'单击计算按钮
    Dim Total As Long
    Dim Number As Integer
    Number = Val(Text1.Text)
    Total = Fib(Number)
    Text2.Text = Total
End Sub


⌨️ 快捷键说明

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