竟然多了个1
程序代码:
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100 int main() { float ten_hex = 0; int inum = 0; float fnum = 0; scanf ("%f", &ten_hex); inum = (int)ten_hex; fnum = ten_hex - inum; printf ("inum is %d\nfnum = %f\n", inum, fnum); //输入123.456 结果 inum = 123, fnum = 0.456001 后面的1哪来的。。。 return 0; }