問(wèn)題已解決
老師,不進(jìn)位取整用int只能用在正數(shù)上,負(fù)數(shù)上就不行呢
![](https://member.chinaacc.com/homes/resources/images/home/avatar/6.jpg)
![](/wenda/_nuxt/img/iconWarn.60bd4fe.jpg)
![](https://pic1.acc5.cn/011/84/04/96_avatar_middle.jpg?t=1651216819)
同學(xué),你好
int函數(shù)是將數(shù)字向下舍入到最接近的整數(shù)
2024 03/12 08:57
![](https://pic1.acc5.cn/011/84/04/96_avatar_middle.jpg?t=1651216819)
小菲老師 ![](/wenda/_nuxt/img/reply2.28c7604.png)
![](/wenda/_nuxt/img/reply2.28c7604.png)
2024 03/12 08:57
同學(xué),你好
負(fù)數(shù)也是可以的
![](http://member.chinaacc.com/homes/resources/images/home/avatar/6.jpg)
84784956 ![](/wenda/_nuxt/img/reply1.d92ea43.png)
![](/wenda/_nuxt/img/reply1.d92ea43.png)
2024 03/12 10:17
老師,比如-1.32用int就會(huì)取成2了,但是1.32用Int就會(huì)取成1,為什么負(fù)的1.32用int會(huì)取成2呢
![](https://pic1.acc5.cn/011/84/04/96_avatar_middle.jpg?t=1651216819)
小菲老師 ![](/wenda/_nuxt/img/reply2.28c7604.png)
![](/wenda/_nuxt/img/reply2.28c7604.png)
2024 03/12 10:19
同學(xué),你好
-1.32用int就會(huì)取成-2的
你再試試
![](http://member.chinaacc.com/homes/resources/images/home/avatar/6.jpg)
84784956 ![](/wenda/_nuxt/img/reply1.d92ea43.png)
![](/wenda/_nuxt/img/reply1.d92ea43.png)
2024 03/12 11:07
是啊,-1.32用inty就會(huì)成-2,不會(huì)取成-1呢,為什么不能取成-1呢
![](https://pic1.acc5.cn/011/84/04/96_avatar_middle.jpg?t=1651216819)
小菲老師 ![](/wenda/_nuxt/img/reply2.28c7604.png)
![](/wenda/_nuxt/img/reply2.28c7604.png)
2024 03/12 11:12
同學(xué),你好
int函數(shù)是將數(shù)字向下舍入到最接近的整數(shù),是往小里面取數(shù)
![](/wenda/img/newWd/sysp_btn_eye.png)