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

📄 form1.frm

📁 我用VB做的一个校园导游系统!界面友好
💻 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  'Windows Default
   Begin VB.TextBox Text3 
      Height          =   1095
      Left            =   720
      TabIndex        =   3
      Top             =   1680
      Width           =   3015
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   375
      Left            =   3240
      TabIndex        =   2
      Top             =   840
      Width           =   975
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1920
      TabIndex        =   1
      Top             =   840
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   360
      TabIndex        =   0
      Top             =   840
      Width           =   1095
   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


Const MAX = 999

Private Sub Command1_Click()
Dim s(15) As Integer
Dim min_dist As Integer
Dim dis As Integer
Dim j As Integer
Dim dist(12) As Integer
Dim p() As Integer
Dim i As Integer
Dim n As Integer
Dim m As Integer
Dim u As Integer
Dim pre As Integer


Dim a(12, 12) As Integer
For i = 1 To 12
  For j = 1 To 12
  a(i, j) = MAX
  Next j
  Next i
  
a(1, 2) = 5
a(2, 1) = 5
a(1, 6) = 4
a(6, 1) = 4
a(1, 7) = 3
a(7, 1) = 3
a(2, 3) = 2
a(3, 2) = 2
a(3, 4) = 2
a(4, 3) = 2
a(3, 5) = 4
a(5, 3) = 4
a(5, 10) = 6
a(10, 5) = 6
a(6, 7) = 5
a(7, 6) = 5
a(6, 8) = 3
a(8, 6) = 3
a(7, 8) = 4
a(8, 7) = 4
a(7, 11) = 2
a(11, 7) = 2
a(7, 12) = 2
a(12, 7) = 2
a(8, 9) = 3
a(9, 8) = 3
a(9, 10) = 3
a(10, 9) = 3
a(10, 11) = 1
a(11, 10) = 1


n = Val(Text1)
m = Val(Text2)

For i = 1 To 12
 dist(i) = a(n, i)
  s(i) = 0
 Next i

 
 
 
 
For i = 1 To 12
 
 min_dist = MAX

 
 For j = 1 To 12
 If s(j) = 0 And dist(j) < min_dist Then
  u = j
  min_dist = dist(j)
  End If
 Next j
 
 s(u) = 1
 
 For j = 1 To 12
  If s(j) = 0 Then
   dis = dist(u) + a(u, j)
    If dis > dist(j) Then
     dist(j) = dist(j)
     Else: dist(j) = dis
     End If
End If
  Next j
  Next i

  Text3.Text = dist(m)
   End Sub

⌨️ 快捷键说明

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