顺序查找.frm

来自「各种排序查找法与一些优秀的算法,包括二分查找,利用递推公式计算(裴波拉契数列),」· FRM 代码 · 共 71 行

FRM
71
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2055
   ClientLeft      =   60
   ClientTop       =   465
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2055
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "查找"
      Height          =   375
      Left            =   3360
      TabIndex        =   3
      Top             =   960
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "生成数组"
      Height          =   375
      Left            =   3360
      TabIndex        =   2
      Top             =   240
      Width           =   975
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   960
      Width           =   2895
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   2895
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
Dim search As Variant
Private Sub command1_click()
  Dim element As Variant
  search = Array(16, 39, 17, 12, 88, 76, 43, 27, 64, 50)
  For Each element In search
    Text1.Text = Text1.Text & Str(element)
  Next element
End Sub

Private Sub Command2_Click()
  Dim i As Integer, find As Integer
  Text2.Text = ""
  find = InputBox("输入要查找的数")
  For i = 1 To UBound(search)
    If search(i) = find Then Exit For
  Next i
  If i <= UBound(search) Then
    Text2.Text = "要查找的数" & CStr(search(i)) & "是search(" & CStr(i) & ")"
  Else
  Text2.Text = "在数列中没有找到" & Str(find)
  End If
End Sub

⌨️ 快捷键说明

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