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

📄 序数法.frm

📁 这是硕士生计算机软件专业组合数学的一个序数算法演示
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   Caption         =   "组合数学---序数法"
   ClientHeight    =   2835
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5055
   Icon            =   "序数法.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   2835
   ScaleWidth      =   5055
   StartUpPosition =   3  '窗口缺省
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   5
      Top             =   2460
      Width           =   5055
      _ExtentX        =   8916
      _ExtentY        =   661
      Style           =   1
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   1
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton Command3 
      Caption         =   "清  空"
      Height          =   375
      Left            =   3240
      TabIndex        =   4
      Top             =   1800
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "序数 =〉排列"
      Height          =   375
      Left            =   3240
      TabIndex        =   3
      Top             =   1080
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "排列 =〉序数"
      Height          =   375
      Left            =   3240
      TabIndex        =   2
      Top             =   360
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   960
      TabIndex        =   1
      Top             =   1560
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   960
      TabIndex        =   0
      Top             =   600
      Width           =   1815
   End
   Begin VB.Frame Frame1 
      Height          =   2175
      Left            =   3000
      TabIndex        =   6
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label Label2 
      Caption         =   "序 数:"
      Height          =   255
      Left            =   120
      TabIndex        =   8
      Top             =   1680
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "排 列:"
      Height          =   375
      Left            =   120
      TabIndex        =   7
      Top             =   720
      Width           =   735
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim P(4) As Integer
Dim A(4) As Integer
Private Sub Command1_Click()
Dim i, j As Integer
Dim inputstring As String
Dim m, n As Integer

'input data
inputstring = ""
inputstring = Text1.Text

For i = 1 To 4
  P(i) = Val(Mid(inputstring, i, 1))
Next
'test data
StatusBar1.SimpleText = "排列转换序数:" & P(1) & P(2) & P(3) & P(4)
'compare data
For i = 1 To 4
    m = P(i)
    n = 0
    For j = i + 1 To 4
      If m > P(j) Then
        n = n + 1
      End If
    Next
   A(m - 1) = n
Next
'output data
Text2.Text = A(3) & A(2) & A(1)
'test data
StatusBar1.SimpleText = StatusBar1.SimpleText & " ==> " & A(3) & A(2) & A(1)
      
End Sub

Private Sub Command2_Click()
Dim i, j, k, s As Integer
Dim m, n As Integer
Dim inputstring As String
'input data
inputstring = ""
inputstring = Text2.Text

For i = 1 To 3
  A(i) = Val(Mid(inputstring, i, 1))
Next
A(0) = A(3)
A(3) = A(1)
A(1) = A(0)

'test data
StatusBar1.SimpleText = ""
StatusBar1.SimpleText = "序数转换排列:" & A(3) & A(2) & A(1)
P(1) = 1
P(2) = 1
P(3) = 1
P(4) = 1

For i = 3 To 1 Step -1
    m = A(i)
    n = 0
    For j = 1 To 4
      If P(j) = 1 Then
        s = 0
       P(j) = i + 1
          For k = j + 1 To 4
             If P(j) > P(k) Then
                 s = s + 1
             End If
          Next
        If m <> s Then
           P(j) = 1
         End If
      End If
    Next
Next
'output data
'For i = 1 To 3
'   m = A(4 - i)
'   n = 5 - i
'   Select Case m
'   Case 0
'      P(n) = n
'   Case 1
'      P(n - 1) = n
'   Case 2
'      P(n - 2) = n
'   Case 3
'      P(n - 3) = n
'   End Select
'Next

'input 0
'For i = 1 To 4
'   If P(i) = 0 Then
'    P(i) = 1
'   End If
'Next

'outputdata
Text1.Text = P(1) & P(2) & P(3) & P(4)
 'test data

StatusBar1.SimpleText = StatusBar1.SimpleText & " ==> " & P(1) & P(2) & P(3) & P(4)
        
End Sub

Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
StatusBar1.SimpleText = ""
End Sub

⌨️ 快捷键说明

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