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

📄 onepoly.frm

📁 一个不仅可以进行常规运行(常规运算能一下计算一个多项式如:1.2*2-3*(3.5+6.7)...)还可以计算矩阵运算的计算机器
💻 FRM
字号:
VERSION 5.00
Begin VB.Form onePoly 
   Caption         =   "一元多次计算器"
   ClientHeight    =   3120
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8145
   LinkTopic       =   "Form2"
   ScaleHeight     =   3120
   ScaleWidth      =   8145
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton clr 
      Caption         =   "重置"
      Height          =   615
      Left            =   3000
      TabIndex        =   7
      Top             =   2160
      Width           =   1575
   End
   Begin VB.CommandButton cal 
      Caption         =   "计算"
      Height          =   615
      Left            =   360
      TabIndex        =   6
      Top             =   2160
      Width           =   1335
   End
   Begin VB.TextBox resultx 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2295
      Left            =   5520
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   4
      Top             =   600
      Width           =   2175
   End
   Begin VB.TextBox numOfPoly 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   1320
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   2
      Top             =   720
      Width           =   3855
   End
   Begin VB.TextBox maxM 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   240
      TabIndex        =   0
      Top             =   720
      Width           =   735
   End
   Begin VB.Label Label3 
      Caption         =   "运算结果:"
      Height          =   375
      Left            =   6120
      TabIndex        =   5
      Top             =   240
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "相应次数的的系数,没有的用0表示"
      Height          =   375
      Left            =   1800
      TabIndex        =   3
      Top             =   240
      Width           =   2895
   End
   Begin VB.Label Label1 
      Caption         =   "最高次数:"
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Width           =   855
   End
End
Attribute VB_Name = "onePoly"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim numOfPolyText(9) As Double              '存放多项式各系数
Dim numOfPolyTextStr(9) As String
Dim maxMText As Integer                     '存放多项式最高次数
Private Sub getNumOfPoly()
Dim i As Integer
Dim tempStr As String
Dim tempLen As Integer
Dim tempText As String
Dim tempM As Integer
Dim sign As Boolean                 '标志所得到的数是否为负数

sign = False
tempText = numOfPoly.Text
tempLen = Len(tempText)
maxMText = Int(maxM.Text)
tempM = maxMText

If tempLen > 0 Then
    tempStr = Left(tempText, 1)
    tempLen = tempLen - 1
    tempText = Right(tempText, tempLen)
    
    If Asc(tempStr) = 32 Then
        Do While Asc(tempStr) = 32 And tempLen > 0
            tempStr = Left(tempText, 1)
            tempLen = tempLen - 1
            tempText = Right(tempText, tempLen)
        Loop
    Else
        Do While tempLen >= 0
            If (Asc(tempStr) >= 48 And Asc(tempStr) <= 57) Or Asc(tempStr) = 45 Or Asc(tempStr) = 46 Then
                Do While (Asc(tempStr) >= 48 And Asc(tempStr) <= 57) Or Asc(tempStr) = 45 Or Asc(tempStr) = 46
                    numOfPolyTextStr(tempM) = numOfPolyTextStr(tempM) + tempStr
                    tempStr = Left(tempText, 1)
                    tempLen = tempLen - 1
                    If tempLen <= 0 Then
                        Exit Do
                    Else
                        tempText = Right(tempText, tempLen)
                    End If
                Loop
                If tempM > 0 Then
                    tempM = tempM - 1
                Else
                    Exit Do
                End If
            ElseIf Asc(tempStr) = 32 Then
                Do While Asc(tempStr) = 32
                    tempStr = Left(tempText, 1)
                    tempLen = tempLen - 1
                    If tempLen <= 0 Then
                        Exit Do
                    Else
                        tempText = Right(tempText, tempLen)
                    End If
                Loop
            Else
                MsgBox ("输入系有误")
            End If
        Loop
    End If
Else
    MsgBox ("矩阵2输入框中为空")
End If

For i = 0 To maxMText
    numOfPolyText(i) = Val(numOfPolyTextStr(i))
Next i

End Sub
Private Sub cal_Click()
Dim i As Integer

Call getNumOfPoly
For i = maxMText To 0 Step -1
    resultx.Text = resultx.Text + str(numOfPolyText(i)) + " "
Next i
End Sub

Private Sub clr_Click()
Dim i As Integer

For i = 0 To 9
    numOfPolyText(i) = 0
Next i

resultx.Text = ""
maxM.Text = ""
numOfPoly.Text = ""

End Sub

⌨️ 快捷键说明

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