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

📄 modlinear.bas

📁 Visual Basic 6 大学教程的代码
💻 BAS
字号:
Attribute VB_Name = "modLinear"
' Code module modLinear.bas
Option Explicit

Function LinearSearch(a() As Integer, key As Integer) As Integer
   Dim x As Integer

   For x = LBound(a) To UBound(a)

      If a(x) = key Then
         LinearSearch = x   ' Return index
         Exit Function
      End If

   Next x

   LinearSearch = -1        ' Value not found
End Function

⌨️ 快捷键说明

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