jar*_*rus 2 c# visual-studio-2005 console-application
我有一个方程式,需要一个数字乘以给定的次数,如:
2 ^ 5 but if i implement the carrot '^' sign it doesnt give the required result ...
我做错了吗?
如果是的话,它的正确表达方式是什么?
Aak*_*shM 8
在C#中,^是'独占或'运算符.对于取幂,你需要使用Math.Pow():
^
Math.Pow()
double d = Math.Pow(2, 5);
Dav*_*nde 5
使用 Math.Pow(2, 5)
Math.Pow(2, 5)
胡萝卜符号"^"用于布尔和按位异或运算.你用它来计算功率的想法来自VB/VB.NET.
归档时间:
16 年,6 月 前
查看次数:
758 次
最近记录: