clsstatistic.cls

来自「师兄做的一个利用VB结合mapx组件做的超市查询小系统」· CLS 代码 · 共 56 行

CLS
56
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsStatistic"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

Option Explicit

Dim fAve As Single
Dim fMax As Single
Dim fMin As Single



Public Function GetAverage(fData() As Single, RowCount As Integer) As Single
    Dim i As Integer
    Dim dSum As Double
    
    For i = 1 To RowCount
        dSum = dSum + fData(i)
    Next i
    GetAverage = dSum / RowCount
End Function



Public Function GetMax(fData() As Single, RowCount As Integer) As Single
    Dim i As Integer
    fMax = fData(1)
    For i = 1 To RowCount
        If fMax < fData(i) Then
            fMax = fData(i)
        End If
    Next i
    GetMax = fMax
End Function

Public Function GetMin(fData() As Single, RowCount As Integer) As Single
    Dim i As Integer
    fMin = fData(1)
    For i = 1 To RowCount
        If fMin > fData(i) Then
            fMax = fData(i)
        End If
    Next i
    GetMin = fMin
End Function

⌨️ 快捷键说明

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