Re: [VB6 ] 計算機
※ 引述《fumizuki (小獅子)》之銘言:
: '指數運算
: o = "^": GoSub SearchProc
指數前面應該不會有人打+-*/號吧???
: If p > 0 Then
: GoSub SplitProc
: If op1 Like "-*" Then
: Eval = -Eval(Mid(op1, 2)) ^ Eval(op2)
: Else
: Eval = Eval(op1) ^ Eval(op2)
: End If
: GoTo EndProc
: End If
: Eval = Val(s)
: EndProc:
: c = c - 1: Exit Function
: SearchProc:
: p = Len(s) + 1
: Do
: p = InStrRev(s, o, p - 1)
: If p <= 1 Then
: f = 0 '首字忽略;找不到則離開迴圈
: Else
: a = Mid(s, p - 1, 1)
: If a = "+" Or a = "-" Or a = "*" Or a = "/" Or a = "^" Then
: f = 1
: Else
: f = 0
: End If
: End If
: Loop While f = 1
: If p = 1 Then p = 0
: Return
: a = Mid(s, p - 1, 1)
: If a = "+" Or a = "-" Or a = "*" Or a = "/" Or a = "^" Then
: f = 1
: Else
: f = 0
: End If
: End If
: Loop While f = 1
: If p = 1 Then p = 0
: Return
--
少年讀書,如隙中窺月;
中年讀書,如庭中望月;
老年讀書,如臺上玩月。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.141.158.129
推
210.58.156.43 06/12, , 1F
210.58.156.43 06/12, 1F
推
210.58.156.43 06/12, , 2F
210.58.156.43 06/12, 2F
推
220.141.158.129 06/12, , 3F
220.141.158.129 06/12, 3F
推
210.58.156.43 06/12, , 4F
210.58.156.43 06/12, 4F
推
220.141.158.129 06/12, , 5F
220.141.158.129 06/12, 5F
推
210.58.156.43 06/12, , 6F
210.58.156.43 06/12, 6F
推
220.141.158.129 06/12, , 7F
220.141.158.129 06/12, 7F
討論串 (同標題文章)
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章