用程序处理 比如123.123 变成123, 谢谢了
有两种方法:
使用函数:
#include<stdio.h>
void main()
{ double x,temp; int a; scanf("%lf",&x);
temp=x; a=int(temp);
while(a!=temp
{ temp=temp*10; a=int(temp);
} printf("%d\n",a); }
2.使用强制转换命令:(int)f;
注意:在转换的时候,前面的转换型一定要打括号,否则不起作用。