cmtofeet.c

来自「The art and science of c_source code!」· C语言 代码 · 共 25 行

C
25
字号
/* * File: cmtofeet.c * ---------------- * This program reads in a length given in centimeters and converts * it to its English equivalent in feet and inches. */#include <stdio.h>#include "genlib.h"#include "simpio.h"main(){    double totalInches, cm, inch;    int feet;    printf("This program converts centimeters to feet and inches.\n");    printf("Length in centimeters? ");    cm = GetReal();    totalInches = cm / 2.54;    feet = totalInches / 12;    inch = totalInches - feet * 12;    printf("%g cm = %d ft %g in\n", cm, feet, inch);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?