0
我正在做的是這樣的,我離開了5',然後我轉了3 「除以12,然後我用分母除以分子,然後我將它加起來並乘以1.414它的工作原理,但我不知道如何顯示英尺和英寸的分數我如何採取像5'3「1/2的測量,然後乘以1.414,並在Android java上顯示相同格式的答案
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");
......那個孩子呢,就是爲什麼世界其他地方(除了美國和英國)已經度過了...... ;-) –
@aamos - 呃......英國在很多年前就開始計量了。 http://en.wikipedia.org/wiki/Metrication_in_the_United_Kingdom#Current_usage現在可以肯定的是,很多人不喜歡它......但你不能取悅每個人。 –