没事写了这个东西!!~~
VERSION 5.00
Begin VB.Form Form1
Caption = "物种多样性"
ClientHeight = 3330
ClientLeft = 120
ClientTop = 450
ClientWidth = 4890
Icon = "Form1.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3330
ScaleWidth = 4890
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "样方法"
Height = 735
Left = 600
TabIndex = 2
Top = 1920
Width = 3735
End
Begin VB.CommandButton Command2
Caption = "辛普森指数2(/)"
Height = 615
Left = 600
TabIndex = 1
Top = 1320
Width = 3735
End
Begin VB.CommandButton Command1
Caption = "辛普森指数1(-)"
Height = 855
Left = 600
TabIndex = 0
Top = 480
Width = 3735
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a, mu, b, zi
Private Sub Command1_Click()
On Error Resume Next
b = 1
mu = 0
a = InputBox("请输入物种数量")
For i = 1 To a
b = InputBox("请输入第" & i & "种生物")
mu = mu + b
zi = zi + b ^ 2
Next i
mu = mu ^ 2
zhi = 1 - (zi / mu)
MsgBox "值为:0" & zhi
MsgBox "e=" & zi & "/" & mu
End Sub
Private Sub Command2_Click()
On Error Resume Next
b = 1
mu = 0
a = InputBox("请输入物种数量")
For i = 1 To a
b = InputBox("请输入第" & i & "种生物")
mu = mu + b
zi = zi + b ^ 2
Next i
mu = mu ^ 2
zhi = 1 / (zi / mu)
MsgBox "e=" & zi & "/" & mu
MsgBox "值为:0" & zhi
End Sub
Private Sub Command3_Click()
a = InputBox("请输入有标记数量")
b = InputBox("请输入捕获总量")
c = InputBox("输入总标记量")
MsgBox ("值为:" & a * b / c)
End Sub |