#include <stdio.h>
#include <math.h>
int main (void)
{
float inches;
printf("Enter the number of inches\n");
scanf("%f\n",&inches);
float feet;
float cm;
float yards;
float meter;
feet = 12 * inches;
cm = 2.54 * inches;
yards = 36 * inches;
meter = 39.37 * inches;
printf("Amount in feet: %f\n", &feet);
printf("Amount in cm: %f\n", &cm);
printf("Amount in yards: %f\n", &yards);
printf("Amount in meters: %f\n", &meter);
getchar();
return 0;
}
我正在使用开发 C++
是我正在用 C 语言处理的问题吗?基本上以英寸为单位输入一个数字,然后以厘米、码、米和英尺为单位打印数量。这给了我 0.0000 或其他所有人的东西,或者实际上是时间到了。我无法保持屏幕打开,我认为这是 getchar() 的目的,但我一定是弄错了。任何帮助都很棒。谢谢!
编辑 1
至于将 dev c++ 保留在屏幕上而不是在我放入东西后关闭呢?当屏幕弹出时,我还必须输入 2 个值才能返回任何内容?为什么??