求个高手帮我看看程序35.36行错误在哪,纠结我一天了
#include <stdio.h>#include <math.h>
int main()
{
float norms (float); //声明五个原函数 norms(标准身高),normswei(标准体重),percentwei(体重差额百分比)
float pcdif (float , float); // pcdif(身高差额的百分比), showit(显示计算的结果)
void showit(float , float ,float ,float);
float normswei (float);
float percentwei (float, float);
int years, months; //定义变量years ,months ,height ,normht ,age ,perdif
float height ,normht;
float age , perdif;
float weight; //定义weight(体重)percentweight(体重差额)
float percentweight, normweight;
/*这是输入部分*/
printf("\n How old (in years) is this child? ");
scanf("%d", &years);
printf("How many months since the child's birthday? ");
scanf("%d",&months);
age = years + months/12.0; //年龄转换
printf("Enter the child's height (in inches): ");
scanf("%f" ,&height);
printf("Enter the chlid's weight (in kilogram): ");
scanf("%f",&weight);
/*这是计算部分*/
normht = norms(age);
perdif = pcdif(height, normht);
normweight = normswei(age);
percentweight = percentwei(weight ,normweight);
showit(normht, perdif, normweight, percentweight);
return 0;
}
/*下面是函数的占位函数*/
float norms (float age)
{
#define MINAGE 6.0
float agedif, avght;
agedif = age - MINAGE;
avght = -0.25*pow(agedif,2) + 3.5*agedif + 45.0;
return(avght);
}
float pcdif (float actual, float base)
{
return(actual - base)/base * 100.0;
}
float normweight(float age)
{
float Norm;
Norm=0.5*(age - 6)+5.0*(age - 6 ) + 48;
return (Norm);
}
float percentweight(float actualwei, float normweights)
{
return((actualwei - normweights)/normweights * 100.0);
}
void showit(float normht, float perdif, float normweight, float percentweight)
{
printf("\nThe average height in inches is: %5.2f\n", normht);
printf("The actual height deviates from the norm by: %6.2f%c",perdif,'%');
printf("\nThe average weight in kilogram is: %5.2f\n", normweight);
printf("The actual weight deviates from the norm by: %6.2f%c",percentweight,'%');
}
35行和36行出问题了,编译提示说“undefined reference to'normswei(float)'”
可是我明明已经定义了