📄
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5655
ClientLeft = 60
ClientTop = 345
ClientWidth = 6360
LinkTopic = "Form1"
ScaleHeight = 5655
ScaleWidth = 6360
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame5
Caption = "公式"
Height = 375
Left = 2760
TabIndex = 11
Top = 3120
Width = 1335
End
Begin VB.Frame Frame4
Caption = "x"
Height = 375
Left = 240
TabIndex = 10
Top = 3360
Width = 1215
End
Begin VB.Frame Frame3
Caption = "x1"
Height = 375
Left = 120
TabIndex = 9
Top = 1920
Width = 1215
End
Begin VB.Frame Frame2
Caption = "x0"
Height = 375
Left = 120
TabIndex = 8
Top = 480
Width = 975
End
Begin VB.Frame Frame1
Caption = "值"
Height = 375
Left = 2760
TabIndex = 7
Top = 1320
Width = 1095
End
Begin VB.TextBox Text5
Height = 855
Left = 2760
TabIndex = 6
Top = 1680
Width = 2415
End
Begin VB.TextBox Text4
Height = 855
Left = 2760
TabIndex = 5
Top = 3480
Width = 2175
End
Begin VB.CommandButton Command2
Caption = " 公式"
Height = 495
Left = 5160
TabIndex = 4
Top = 3600
Width = 1215
End
Begin VB.TextBox Text3
Height = 615
Left = 240
TabIndex = 3
Top = 3720
Width = 1815
End
Begin VB.TextBox Text2
Height = 615
Left = 120
TabIndex = 2
Top = 2280
Width = 1815
End
Begin VB.TextBox Text1
Height = 615
Left = 120
TabIndex = 1
Top = 840
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "计算"
Height = 495
Left = 5280
TabIndex = 0
Top = 1800
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim x0 As Double
Dim x1 As Double
Dim t0 As Double
Dim t1 As Double
Dim y0 As Double
Dim y1 As Double
Dim y As Double
x0 = Text1.Text
x1 = Text2.Text
x = Text3.Text
y0 = Exp(-x0)
y1 = Exp(-x1)
t0 = (x - x1) / (x0 - x1)
t1 = (x - x0) / (x1 - x0)
y = t0 * y0 + t1 * y1
Text5.Text = ccstr(y)
End Sub
Private Sub Command2_Click()
Dim x0 As Double
Dim x1 As Double
Dim y0 As Double
Dim y1 As Double
Dim t0 As String
Dim t1 As String
x0 = Text1.Text
x1 = Text2.Text
y0 = Exp(-x0)
y1 = Exp(-x1)
t0 = "(x-" + ccstr(x1) + ")/" + ccstr((x0 - x1))
t1 = "(x-" + ccstr(x0) + ")/" + ccstr((x1 - x0))
y = "(" + t0 + ")" + "*" + ccstr(y0) + "+" + "(" + t1 + ")" + "*" + ccstr(y1)
Text4.Text = y
End Sub
Function ccstr(a As Double)
If 0 < a And a < 1 Then ccstr = "0" + CStr(a) '特殊情况 为-1到1 之间的数字
If -1 < a And a < 0 Then ccstr = "-0" + CStr(Abs(a))
If CStr(a) = "0" Then ccstr = "0"
If Abs(a) >= 1 Then ccstr = CStr(a)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -