📄 clsaccount.txt
字号:
Option Explicit
Private mstrAccountNames(1 To 100) As String
Private mdblAccountBalances(1 To 100) As Double
Public Property Get AccountNames()
AccountNames = mstrAccountNames
End Property
Public Property Get AccountBalances()
AccountBalances = mdblAccountBalances
End Property
Public Function Create(accountName As String, amount As Double) As Integer
Dim index As Integer
Dim flag As Boolean
index = 1
Do While (True)
If mstrAccountNames(index) = "" Then
Create = index
mstrAccountNames(index) = accountName
mdblAccountBalances(index) = amount
Exit Do
End If
index = index + 1
If index > 100 Then
Exit Do
End If
Loop
End Function
Public Function Remove(accountName As String) As Integer
Dim index As Integer
Dim flag As Boolean
index = 1
Do While (True)
If mstrAccountNames(index) = accountName Then
Remove = index
mstrAccountNames(index) = ""
mdblAccountBalances(index) = 0
Exit Do
End If
index = index + 1
If index > 100 Then
Exit Do
End If
Loop
End Function
Public Function Deposit(accountName As String, amount As Double) As Integer
Dim index As Integer
Dim flag As Boolean
index = 1
Do While (True)
If mstrAccountNames(index) = accountName Then
Deposit = index
mdblAccountBalances(index) = mdblAccountBalances(index) + amount
Exit Do
End If
index = index + 1
If index > 100 Then
Exit Do
End If
Loop
End Function
Public Function Withdrawal(accountName As String, amount As Double) As Integer
Dim index As Integer
Dim flag As Boolean
index = 1
Do While (True)
If mstrAccountNames(index) = accountName Then
Withdrawal = index
mdblAccountBalances(index) = mdblAccountBalances(index) - amount
Exit Do
End If
index = index + 1
If index > 100 Then
Exit Do
End If
Loop
End Function
Public Function GetAccountBalance(accountName As String) As Double
Dim index As Integer
Dim flag As Boolean
index = 1
Do While (True)
If mstrAccountNames(index) = accountName Then
GetAccountBalance = mdblAccountBalances(index)
Exit Do
End If
index = index + 1
If index > 100 Then
Exit Do
End If
Loop
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -