VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1500
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4140
   LinkTopic       =   "Form1"
   ScaleHeight     =   1500
   ScaleWidth      =   4140
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "For"
      Height          =   495
      Left            =   2520
      TabIndex        =   1
      Top             =   840
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Do While"
      Height          =   495
      Left            =   840
      TabIndex        =   0
      Top             =   840
      Width           =   1215
   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 s!, t!, i&
    s = 1
    t = 1
    i = 1
    Do While 1 / t > 0.00001
      t = t + i
      s = s + 1 / t
      i = i + 1
    Loop
    Print "Do While结构"; s, i - 1; "项"
End Sub

Private Sub Command2_Click()
     Dim s!, t!, i&
     s = 1
     t = 1
     For i = 1 To 100000
      t = t + i
      s = s + 1 / t
      If 1 / t < 0.00001 Then Exit For
    Next i
    Print "For结构"; s, i; "项"
End Sub

    

