double double_int(double a) {//去除double型数据的小数部分,保留整数部分 double i = 1, power = 1, a1 = 0;//i为a的整数位数,power为整数部分最高位权重 for (double n = a / 10; n >= 1; i++)//求i(整数位数) n /= 10; if (i < 10) return int(a); else { for (int j = 1; j < i; j++)//求power power *= 10; for (int j = 0; j < i; power /= 10, j++)//求a的整数部分 a1 += int((a - a1) / power) * power; return a1; } }