<VB数理统计实用算法>书中的算法源程序

源代码在线查看: 指数f2.frm

软件大小: 11653 K
上传用户: zhou28
关键词: 算法 lt VB gt
下载地址: 免注册下载 普通下载 VIP

相关代码

				VERSION 5.00
				Begin VB.Form frmCalculate 
				   Appearance      =   0  'Flat
				   BackColor       =   &H80000005&
				   Caption         =   "物价指数"
				   ClientHeight    =   3630
				   ClientLeft      =   165
				   ClientTop       =   555
				   ClientWidth     =   4065
				   LinkTopic       =   "Form1"
				   ScaleHeight     =   6.403
				   ScaleMode       =   7  'Centimeter
				   ScaleWidth      =   7.17
				   StartUpPosition =   3  '窗口缺省
				   Begin VB.CommandButton cmdExit 
				      Caption         =   "退  出"
				      Height          =   375
				      Left            =   3000
				      TabIndex        =   3
				      Top             =   3000
				      Width           =   855
				   End
				   Begin VB.CommandButton cmdSave 
				      Caption         =   "保  存"
				      Height          =   375
				      Left            =   2040
				      TabIndex        =   2
				      Top             =   3000
				      Width           =   855
				   End
				   Begin VB.CommandButton cmdPrint 
				      Caption         =   "打  印"
				      Height          =   375
				      Left            =   1080
				      TabIndex        =   1
				      Top             =   3000
				      Width           =   855
				   End
				   Begin VB.CommandButton cmdCalculate 
				      Caption         =   "计  算"
				      Height          =   375
				      Left            =   120
				      TabIndex        =   0
				      Top             =   3000
				      Width           =   855
				   End
				   Begin VB.Label lblvalue 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   5
				      Left            =   2520
				      TabIndex        =   15
				      Top             =   2520
				      Width           =   2295
				   End
				   Begin VB.Label lblvalue 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   3
				      Left            =   2520
				      TabIndex        =   14
				      Top             =   1560
				      Width           =   2175
				   End
				   Begin VB.Label lbltitle 
				      Alignment       =   1  'Right Justify
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "居民消费支出的变化:"
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   5
				      Left            =   120
				      TabIndex        =   13
				      Top             =   2520
				      Width           =   2415
				   End
				   Begin VB.Label lbltitle 
				      Alignment       =   1  'Right Justify
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "居民消费支出的变化:"
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   3
				      Left            =   0
				      TabIndex        =   12
				      Top             =   1560
				      Width           =   2535
				   End
				   Begin VB.Label lblvalue 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   4
				      Left            =   2520
				      TabIndex        =   11
				      Top             =   2040
				      Width           =   2295
				   End
				   Begin VB.Label lblvalue 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   2
				      Left            =   2520
				      TabIndex        =   10
				      Top             =   1080
				      Width           =   2295
				   End
				   Begin VB.Label lblvalue 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   1
				      Left            =   2520
				      TabIndex        =   9
				      Top             =   600
				      Width           =   2295
				   End
				   Begin VB.Label lblvalue 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   0
				      Left            =   2520
				      TabIndex        =   8
				      Top             =   120
				      Width           =   2175
				   End
				   Begin VB.Label lbltitle 
				      Alignment       =   1  'Right Justify
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "报告期加权综合物价指数:"
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   4
				      Left            =   120
				      TabIndex        =   7
				      Top             =   2040
				      Width           =   2415
				   End
				   Begin VB.Label lbltitle 
				      Alignment       =   1  'Right Justify
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "基准期加权综合物价指数:"
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   2
				      Left            =   120
				      TabIndex        =   6
				      Top             =   1080
				      Width           =   2415
				   End
				   Begin VB.Label lbltitle 
				      Alignment       =   1  'Right Justify
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "简单综合指数:"
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   1
				      Left            =   120
				      TabIndex        =   5
				      Top             =   600
				      Width           =   2415
				   End
				   Begin VB.Label lbltitle 
				      Alignment       =   1  'Right Justify
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "几何平均指数:"
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Index           =   0
				      Left            =   120
				      TabIndex        =   4
				      Top             =   120
				      Width           =   2415
				   End
				End
				Attribute VB_Name = "frmCalculate"
				Attribute VB_GlobalNameSpace = False
				Attribute VB_Creatable = False
				Attribute VB_PredeclaredId = True
				Attribute VB_Exposed = False
				'计算窗体
				Dim R(1 To 6) As Double, S(1 To 6) As Single, I As Integer
				Dim strFileOut As String, intFileOut As Integer
				
				Private Sub Form_Load()
				    cmdPrint.Visible = False                '“打印”命令按钮不可视
				    cmdSave.Visible = False                 '“保存”命令按钮不可视
				End Sub
				
				'计算
				Private Sub cmdCalculate_Click()
				    Price_Index P, R                         '调用标准模块中计算指数的过程
				'将计算结果放入标签显示
				    For I = 1 To 6
				        S(I) = R(I)
				        If I = 4 Or I = 6 Then
				            lblvalue(I - 1).Caption = Str(S(I))
				        Else
				            lblvalue(I - 1).Caption = Str(S(I)) & "%"
				        End If
				    Next I
				    cmdPrint.Visible = True                 '“打印”命令按钮可视
				    cmdSave.Visible = True                  '“保存”命令按钮可视
				End Sub
				
				'打印
				Private Sub cmdPrint_Click()
				    MsgBox "现在开始打印,请稍侯"
				    Printer.Print
				    With Printer
				        .FontName = "隶书"
				        .FontSize = 20
				    End With
				    Printer.Print Spc(8); "指数计算结果"
				    With Printer
				        .FontName = "宋体"
				        .FontSize = 14
				    End With
				    For I = 1 To 6
				        Printer.Print Spc(8); lbltitle(I - 1).Caption, lblvalue(I - 1).Caption
				    Next I
				    Printer.EndDoc
				    MsgBox "打印文档已交付打印设备,请继续其他工作"
				End Sub
				
				'保存
				Private Sub cmdSave_Click()
				    strFileOut = frmFile.txtResult.Text     '文件名
				    intFileOut = FreeFile                   '取得空闲的文件号码
				    Open strFileOut For Output As intFileOut
				    Print #intFileOut, "指数计算结果"
				'将计算结果写入文件
				    For I = 1 To 6
				        Print #intFileOut, lbltitle(I - 1).Caption; lblvalue(I - 1).Caption
				    Next I
				    Close #intFileOut                       '关闭文件
				End Sub
				
				'退出
				Private Sub cmdExit_Click()
				    Unload Me
				    End
				End Sub
				
				
							

相关资源