Xcode 使用指数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5963058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:01:05 来源:igfitidea点击:
Xcode Using Exponents
提问by Greg
This is probably a simple question, but I a variable "side" to be divided by the square of the variable "curNum". Currently, my code for this looks like
这可能是一个简单的问题,但我将一个变量“边”除以变量“curNum”的平方。目前,我的代码看起来像
side = inputNum/(curNum^2);
However, this gives me the error "Invalid operands to binary ^" How can I successfully use exponents?
但是,这给了我错误“二进制 ^ 的无效操作数”如何成功使用指数?
回答by Kai Huppmann
Try
尝试
pow(curNum, 2)
Should work......
应该管用......