我正在做的是这个,我不理会 5' 然后我把 3" 除以 12 变成小数点,然后我将分子除以分母,然后我把它全部加起来并乘以 1.414 它可以工作但是我不知道如何显示英尺英寸和几分之一英寸
c2c_fdecimal = f_num / f_den;
c2c_fdeci_fft = c2c_fdecimal / 12.0;
deci_of_foot = inchs / 12.0;
total_travel= feet + c2c_fdeci_fft + deci_of_foot;
toff_ftodeci = tkoff_numa / tkoff_dena;
tkoff_inch = tkoff_inch / 12.0;
sub_toff = toff_ftodeci / 12.0 + tkoff_inch;
ans = (total_travel * ffformula) - sub_toff;
//print out measurement format
ansint = (int)ans;
strip_inches = (int) ((ans - ansint) * 12.0);
//print answer
editText2.setText(ansint + " ft" + strip_inches + " in");