C# 无法获取Math.Abs的值(-2147483648)
这是我的密码C# 无法获取Math.Abs的值(-2147483648),c#,C#,这是我的密码 string strTemp = ""; for (int i = input1; i <= input2; i++) { strTemp = Math.Abs(i).ToString(); //other stuff here } 字符串strTemp=”“; for(int i=input1;i+2147483648大于int的最大值,即231-1。 相反,您可以使用long;它的最大值是263-1 如果这还不够,请使用biginger+21474836
string strTemp = "";
for (int i = input1; i <= input2; i++)
{
strTemp = Math.Abs(i).ToString();
//other stuff here
}
字符串strTemp=”“;
for(int i=input1;i+2147483648
大于int
的最大值,即231-1。
相反,您可以使用long
;它的最大值是263-1
如果这还不够,请使用biginger
+2147483648
大于int
的最大值,即231-1。
相反,您可以使用long
;它的最大值是263-1
如果这还不够,请使用biginger
那么你的意思是我必须像Math.Abs((long)I)一样将int转换为long。ToString()
@SLaks input1和input2始终是int,并在函数中提供。实际上,我一直在语法上纠结于如何编写?那么你的意思是我必须像Math.Abs((long)I)一样将int转换为long
@SLaks input1和input2始终为int,并在函数中提供。实际上,我对语法感到困惑,无法理解如何编写?