展开全部
(foot+inch/12)*0.3048 = cm / 100
foot+inch/12 = cm / (100 * 0.3048) = cm / 30.48
因为1foot = 12inch,所以inch / 12 < 1,所以foot = cm/30.48的整数部分 inch / 12 = cm/30.48的小数部分。636f
六七行就是完成这个功能。
扩展资料:
一、英尺和英寸的知识
1、1码 = 3英寸 ,1英尺 = 12 英寸;
2、码英文字母是 yard
3、英尺英文字母是 foot( 单数 ) feet( 复数 )
4、英寸英文单词是 inch ( 单数 )inches( 复数 )
二、长度单位转换

#include
#define Mile_to_meter 1609 //1英里 = 1690米
#define Foot_to_centimeter 30.48 //1英里 = 1690米
#define Inch_to_centimeter 2.54 //1英里 = 1690米
int main(){
float mile, foot, inch;
scanf("%f%f%f", &mile, &foot, &inch);
printf("%fmiles = %f meters\n", mile, mile * Mile_to_meter);
printf("%ffeet = %f centimeters\n", foot, foot * Foot_to_centimeter );
printf("%finches = %f centimeters\n", inch, inch * Inch_to_centimeter );
return 0;
}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/59708.html