> 其他 >
编写程序,将输入数据的单位由mile转换到km.已知1mile等于5280foot,1foot=12in,1in=254cm,1km=100000c
人气:359 ℃ 时间:2020-05-28 13:52:44
解答
用什么语言写呢.
计算公式很简单啦:公里数 = 英里数*5280*12*2.54/100000 就可以了.
如果使用C语言:
constant int mile2foot = 5280;
constant int foot2inch = 12;
constant float inch2cent = 2.54; (should be 2.54,not 254)
constant int km2cent = 100000;
float mile,kilometer;
kilometer = mile * mile2foot * foot2inch * inch2cent / km2cent;
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版