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

📄 求数列和.frm

📁 算法教案
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "求数列和"
   ClientHeight    =   1785
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4440
   LinkTopic       =   "Form1"
   ScaleHeight     =   1785
   ScaleWidth      =   4440
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1320
      Locked          =   -1  'True
      TabIndex        =   4
      Top             =   240
      Width           =   2535
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1320
      TabIndex        =   2
      Top             =   960
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   495
      Left            =   2880
      TabIndex        =   0
      Top             =   960
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "请输入n"
      Height          =   255
      Left            =   240
      TabIndex        =   3
      Top             =   1080
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "S="
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   360
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Function f(ByVal n As Integer) As Single
    If n <= 1 Then
       f = -0.5
    Else
       f = (-1) ^ n / (2 * n) + f(n - 1)
    End If
End Function



Private Sub Command1_Click()
    Dim n As Integer
    Dim S As Single
    n = Val(Text1.Text)
    S = f(n)
    Text2.Text = Str(S)
End Sub

Private Sub Text1_Click()
   Text1.Text = ""
   Text2.Text = ""
End Sub

⌨️ 快捷键说明

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