日期:2014-05-18  浏览次数:20382 次

超级简单的问题,分白送!
C#里哪个函数可以让一个浮点数去掉小数部分然后再加1
比如4.23变成5,
2.8变成3
7.1变成8

应该很简单,这个问题

------解决方案--------------------
MS不记得有这样的函数,暂时可以这样做,我再找找看是否有现在成的函数吧

//float f = 4.23f;
//float f = 2.8f;
//float f = 7.1f;
float f = 3.0f;
int i = f-(int)f==0?(int)f:(int)f+1;

------解决方案--------------------
Dim a as single
Dim b as int16
a=3.1
b=cint(a)
response.write(a-b)
response.write( " <br/> ")
if a-b <0 then
response.write(b-1)
else
response.write(b)
end if