作业帮 > 综合 > 作业

英语翻译Private StoredValue As DoublePrivate Const opNone = 0Pri

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/11 04:30:02
英语翻译
Private StoredValue As Double
Private Const opNone = 0
Private Const opAdd = 1
Private Const opSubtract = 2
Private Const opMultiply = 3
Private Const opDivide = 4
Private Operator As Integer
Private NewEntry As Boolean
' Remove the last character.
Private Sub DeleteCharacter()
Dim txt As String
Dim min_len As Integer
txt = txtDisplay.Text
If Left$(txt,1) = "-" Then
min_len = 2
Else
min_len = 1
End If
If Len(txt) > min_len Then
txtDisplay.Text = Left$(txt,Len(txt) - 1)
Else
txtDisplay.Text = "0"
End If
End Sub
' Clear the current entry,saved value,and operator.
Private Sub cmdClear_Click()
cmdClearEntry_Click
StoredValue = 0
Operator = opNone
End Sub
' Clear the current entry.
Private Sub cmdClearEntry_Click()
txtDisplay.Text = ""
End Sub
' Add a decimal point to the display.
Private Sub cmdDecimal_Click()
If InStr(txtDisplay.Text,".") Then
Beep
Else
If NewEntry Then
txtDisplay.Text = "."
NewEntry = False
Else
txtDisplay.Text = txtDisplay.Text & "."
End If
End If
End Sub
' Calculate the result of the previous operation.
Private Sub cmdEquals_Click()
Dim new_value As Double
If txtDisplay.Text = "" Then
new_value = 0
Else
new_value = CDbl(txtDisplay.Text)
End If
Select Case Operator
Case opNone
StoredValue = new_value
Case opAdd
StoredValue = StoredValue + new_value
Case opSubtract
StoredValue = StoredValue - new_value
Case opMultiply
StoredValue = StoredValue * new_value
Case opDivide
StoredValue = StoredValue / new_value
End Select
Operator = opNone
NewEntry = True
txtDisplay.Text = Format$(StoredValue)
End Sub
' Add a number to the display.
Private Sub cmdNumber_Click(Index As Integer)
If NewEntry Then
txtDisplay.Text = Format$(Index)
NewEntry = False
Else
txtDisplay.Text = _
txtDisplay.Text & Format$(Index)
End If
End Sub
' Prepare to perform an operation.
Private Sub cmdOperator_Click(Index As Integer)
' Perform the previous operation.
cmdEquals_Click
' Remember this operation.
Operator = Index
' Start a new value.
NewEntry = True
End Sub
' Change the value's sign.
Private Sub cmdPlusMinus_Click()
If NewEntry Then
txtDisplay.Text = "-"
ElseIf Left$(txtDisplay.Text,1) = "-" Then
txtDisplay.Text = Right$(txtDisplay.Text,2)
Else
txtDisplay.Text = "-" & txtDisplay.Text
End If
End Sub
Private Sub Command1_Click()
End Sub
太大了啊 不能一次性发啊 没办法啊
私人StoredValue双重
私人康斯特opNone = 0
私人康斯特opAdd = 1
私人康斯特opSubtract = 2
私人康斯特opMultiply = 3
私人康斯特opDivide = 4
私人经营者为整数
作为民营NewEntry布尔
'删除最后一个字符.
私人小组DeleteCharacter ( )
作为暗淡文本字符串
昏暗min_len为整数
文本= txtDisplay.Text
如果左$ (文本,1 ) = “ -”然后
min_len = 2
其他的
min_len = 1
如果完
如果莱昂( txt )的“ min_len然后
左txtDisplay.Text = $ ( txt文件,长度(文本) -1 )
其他的
txtDisplay.Text = “ 0 ”
如果完
小组完
'清除当前的输入,保存价值和运营商.
私人小组cmdClear_Click ( )
cmdClearEntry_Click
StoredValue = 0
算子= opNone
小组完
'清除当前的条目.
私人小组cmdClearEntry_Click ( )
txtDisplay.Text = “ ”
小组完
'添加一个小数点的显示.
私人小组cmdDecimal_Click ( )
如果仪表( txtDisplay.Text ,“ .” )然后
响铃
其他的
如果NewEntry然后
txtDisplay.Text = “ .”
NewEntry =假
其他的
txtDisplay.Text = txtDisplay.Text & “ .”
如果完
如果完
小组完
'计算的结果,以前的运作.
私人小组cmdEquals_Click ( )
昏暗new_value双重
如果txtDisplay.Text = “ ”然后
new_value = 0
其他的
new_value = CDbl ( txtDisplay.Text )
如果完
选择经营情况
案例opNone
StoredValue = new_value
案例opAdd
StoredValue = StoredValue + new_value
案例opSubtract
StoredValue = StoredValue -n ew_value
案例opMultiply
StoredValue = StoredValue * new_value
案例opDivide
StoredValue = StoredValue / new_value
最终选择
算子= opNone
NewEntry =真
格式txtDisplay.Text = $ ( StoredValue )
小组完
'添加一个编号,以显示.
私人小组cmdNumber_Click (指数为整数)
如果NewEntry然后
格式txtDisplay.Text = $ (指数)
NewEntry =假
其他的
txtDisplay.Text = _
txtDisplay.Text与格式$ (指数)
如果完
小组完
'准备施行手术.
私人小组cmdOperator_Click (指数为整数)
'执行以前的运作.
cmdEquals_Click
请记住此操作.
算子=指数
'启动一个新的价值.
NewEntry =真
小组完
'的价值变化的迹象.
私人小组cmdPlusMinus_Click ( )
如果NewEntry然后
txtDisplay.Text = “ -”
elseif的左$ ( txtDisplay.Text ,1 ) = “ -”然后
权txtDisplay.Text = $ ( txtDisplay.Text ,2 )
其他的
txtDisplay.Text = “ -” & t xtDisplay.Text
如果完
小组完
私人小组Command1_Click ( )
小组完