mirror of
https://github.com/abakh/nbsdgames.git
synced 2024-12-04 14:46:22 -05:00
also some stupid mistakes in round()
This commit is contained in:
parent
e600887248
commit
6b83ef7b1b
@ -26,16 +26,18 @@ NOTE: This program is only made for entertainment porpuses. The puzzles are gene
|
|||||||
int round(float x)
|
int round(float x)
|
||||||
{
|
{
|
||||||
int y=(int) x;
|
int y=(int) x;
|
||||||
if x>0
|
int z;
|
||||||
if x-y >0.5
|
if(x > 0)
|
||||||
return (int)(x + 0.5);
|
if(x-y > 0.5)
|
||||||
|
z = (int)(x + 0.5);
|
||||||
else
|
else
|
||||||
return y;
|
z = y;
|
||||||
if x<0
|
if(x<0)
|
||||||
if x-y <-0.5
|
if(x-y < -0.5)
|
||||||
return int(x -0.5);
|
z = int(x -0.5);
|
||||||
else
|
else
|
||||||
return y;
|
z = y;
|
||||||
|
return z;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user