#include <stdio.h>
#define CENTIMETER 0.01
#define POUNDS 0.453592
int main (void)
{
float Pounds;
float Kilograms;
float Grams;
float Centimeters;
float Meters;
float Feet;
float Inches;
printf("Please Enter your weight in Pounds : ");
scanf("%f",&Pounds);
Kilograms=Pounds*POUNDS;
Grams=Kilograms*1000;
printf(" Weight in kilograms is %.2f", Kilograms);
printf(" Weight in grams is %.2f", Grams);
printf("\n\n\n\n\n\nAnd ");
printf("Please Enter your height in Centimeters: ");
scand("%f",&Centimeters);
Meters=Centimeters*CENTIMETER;
Feet=Meters*3.28084;
Inches=Feet*12;
printf(" Height in Meters is %.2f", Meters);
printf(" Height in Feet is %.2f", Feet);
printf(" Height in Inches is %.2f", Inches);
getch();
return 0;
}
问题是我无法保存,它说:
“[链接器错误]未定义引用`scand'”,
“ld返回1退出状态”
我很喜欢编程,所以我希望有人可以帮助我..
答案 0 :(得分:1)
该代码包含拼写错误。在本声明中
scand("%f",&Centimeters);
应该有scanf
而不是scand
。
scanf("%f",&Centimeters);