#include<stdio.h> int main(void) {

float weight;
float value;
printf("Are you worth your wight in rhodium?\n");
printf("Let's check it out.\n");
printf("Please enter your wight in pounds: ");
scanf("%f",&wight);
value = 770 * wight * 14.5833;
printf("Your wight in rhodium is worth $%.2f.\n",value);
peintf("You are easily worth that! If rhodium prices drop.\n");
printf("Eat more to maintain your value.\n");
return 0;
}
为什么打不开
--------------------Configuration: cDame - Win32 Debug--------------------
Compiling...
rhodium.c
e:\新建文件夹\cdame\rhodium.c(16) : fatal error C1010: unexpected end of file while looking for precompiled header directive
执行 cl.exe 时出错.
cDame.exe - 1 error(s), 0 warning(s)

我的报错和你的不一样。

我改了几个地方:

    float->double

    scanf里面的%f->%lf

    你的weight后面的都写成了wight

#include<stdio.h>
int main(void)
{
 double weight;
 double value;
 printf("Are you worth your wight in rhodium?\n");
 printf("Let's check it out.\n");
 printf("Please enter your wight in pounds: ");
 scanf("%lf",&weight);
 value = 770 * weight * 14.5833;
 printf("Your wight in rhodium is worth $%.2f.\n",value);
 printf("You are easily worth that! If rhodium prices drop.\n");
 printf("Eat more to maintain your value.\n");
 return 0;
}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-01-17
我的报错和你的不一样。
我改了几个地方:
float->double
scanf里面的%f->%lf
你的weight后面的都写成了wight
#include<stdio.h>int main(void){ double weight; double value; printf("Are you worth your wight in rhodium?\n"); printf("Let's check it out.\n"); printf("Please enter your wight in pounds: "); scanf("%lf",&weight); value = 770 * weight * 14.5833; printf("Your wight in rhodium is worth $%.2f.\n",value); printf("You are easily worth that! If rhodium prices drop.\n"); printf("Eat more to maintain your value.\n"); return 0;}