斯坦福计算器无法正常工作

时间:2015-02-10 13:40:09

标签: ios swift calculator

我在看斯坦福大学快速课程时所做的计算器应用程序有问题。加班我尝试在程序停止的计算器中进行cos,sin,sqrt等计算,并向我显示调试器。我是swift和genrell iOS开发的新手,这里是Thread断点所在的代码

func performOperationForOneNumber(symbol: String, operation: (Double) -> Double) {
        if operandStack.count >= 1 {
            let value = operandStack.removeLast()
            displayValue = operation(value)
            enter()
            switch symbol{
                case "x²": history.text = " (\(value))² ="
                default: history.text = symbol + " \(value) ="
            }
        }
    }

错误出现在if operandStack.count >= 1并且堆栈上只有1个Double。

我需要改变什么?

0 个答案:

没有答案