110,561
社区成员
发帖
与我相关
我的任务
分享
Math.Ceiling()
2 向下取整Math.Floor()
3 四舍六入五成双Math.Round()
4 四舍五入var d=2.5;
var r=Math.Round(d-(int)d+1)-1+(int)d;
http://www.yayawow.com/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%AE%9E%E7%8E%B0c%E7%9A%84%E5%9B%9B%E8%88%8D%E4%BA%94%E5%85%A5/
int GetInt(float value)
{
int result = value / 1;
return result + 1;
}
private int foattoint(double f)
{
int index = f.ToString ().IndexOf(".");
int Z = Convert.ToInt32 (f.ToString().Substring(0, index));
int L=Convert.ToInt32 ( f.ToString ().Substring(index + 1));
if (Convert .ToInt16 (L)!=0)
{
L=1;
}
return Z + L;
}
帮你写了个转换的方法