daonan @ 2021-08-25 17:20:51
#include<stdio.h>
int main ()
{
float a;
long long int d;
scanf("%f",&a);
d=1*a;
printf("%lld",d);
return 0;
}
by wbs200 @ 2021-08-25 17:23:31
@daonan 你拿float类型去乘int类型好像会出问题(不知道对不对)
by _Haoomff_ @ 2021-08-25 17:23:34
@daonan 强转long long
by _Haoomff_ @ 2021-08-25 17:24:18
cout<<(long long)a;
by Textbook_blasphemy @ 2021-08-25 17:24:27
@daonan long long
by wbs200 @ 2021-08-25 17:26:25
@L_YALONG cout的是d吧
by daonan @ 2021-08-25 17:32:45
请问c语言改成d=(long long)a;为什么还是不对呢?还是90qwq
#include<stdio.h>
int main ()
{
float a;
long long int d;
scanf("%f",&a);
d=(long long)a;
printf("%lld",d);
return 0;
}
by _Haoomff_ @ 2021-08-25 17:34:17
@daonan 你上面定long long int,下面用long long,你要是能过还真是奇葩
by Liuyuzhuo @ 2021-08-25 18:28:28
a掉精度了,要开double/long double
by LPX123 @ 2021-12-11 15:05:21
因为虽然题目里说的是单精度(float),但要用双精度(double)系统才算你对