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

📄 newt.frm

📁 NEWT rutine from Numerical Recipes in C translated to VB6
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frmNewt 
   Caption         =   "Prueba de Newt"
   ClientHeight    =   3645
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4455
   LinkTopic       =   "Form1"
   ScaleHeight     =   3645
   ScaleWidth      =   4455
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdSalir 
      Caption         =   "Salir"
      Height          =   375
      Left            =   3120
      TabIndex        =   2
      Top             =   600
      Width           =   1095
   End
   Begin MSFlexGridLib.MSFlexGrid msgResultados 
      Height          =   2415
      Left            =   240
      TabIndex        =   1
      Top             =   1080
      Width           =   3975
      _ExtentX        =   7011
      _ExtentY        =   4260
      _Version        =   393216
   End
   Begin VB.CommandButton cmdCalcular 
      Caption         =   "Calcular"
      Height          =   375
      Left            =   3120
      TabIndex        =   0
      Top             =   120
      Width           =   1095
   End
End
Attribute VB_Name = "frmNewt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdCalcular_Click()
    Const n As Integer = 2
    
    Dim i As Integer, check As Integer
    Dim f() As Double, x() As Double

    ReDim f(1 To n), x(1 To n)
    
    x(1) = 2#
    x(2) = 0.5
    newt x, n, check
    funcv n, x, f
    If check Then
        MsgBox "Convergence Problems"
    Else
        PresentarGrid msgResultados, n, x, f
    End If
End Sub


Private Sub PresentarGrid(ByVal msg As MSFlexGrid, ByVal n As Integer, _
        ByRef x() As Double, ByRef f() As Double)
    
    Dim i As Integer
    
    With msg
        .Rows = 2 * n + 1
        .Cols = 2
        .TextMatrix(0, 0) = "valor"
        .ColWidth(0) = 500
        .ColWidth(1) = 1900
        For i = 1 To n
            .TextMatrix(i, 0) = "x(" & i & ")"
            .TextMatrix(n + i, 0) = "f(" & i & ")"
            .TextMatrix(i, 1) = x(i)
            .TextMatrix(n + i, 1) = f(i)
        Next i
    End With
End Sub

Private Sub cmdSalir_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    ChDir (App.Path)
End Sub

⌨️ 快捷键说明

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