C Primer Plus第六版编程练习5.4

新手欢迎指正
5.4
#include <stdio.h>
#define FEET 2.54
#define INCH 30.48
int main(void)
{
float h=0,inch=0;
int feet=0;
printf(“Please enter a height in centimeters(<=0 to quit):\n”);
scanf("%f",&h);
while(h>0)
{
feet=(int)(h/INCH);
inch=(h-feet*INCH)/FEET;
printf("%.1f cm=%d feet,%.1f inches\n",h,feet,inch);
printf(“Please enter a height in centimeters:\n”);
scanf("%f",&h);
}

/float a,b,c,d,f=0;
printf(“Please enter a height in centimeters:\n”);
scanf("%f",&a);
while ( a>0){
const int m=12;
int e;
b=a/2.54;
c=b/m;
printf("%f\n",c);
e=(int)c;
printf("%d\n",e);
d=b-m
e;
f=
printf("%.1f cm=%d feet,%.1f inches\n",a,e,d);
printf(“Please enter a height in centimeters:\n”);
scanf("%f",&a);
}*/
printf(“bye\n”);
return 0;
}

C Primer Plus第六版编程练习5.4C Primer Plus第六版编程练习5.4 遁锋 发布了4 篇原创文章 · 获赞 0 · 访问量 32 私信 关注
上一篇:husky7.0.2版本使用笔记


下一篇:git commit 提交的时候报错husky > pre-commit hook failed (add --no-verify to bypass)(解决办法)