求助这道题(矩形定义和计算)
#include<stdio.h>struct Rectangle{double length,width;};
struct Rectangle initRectange(double len,double wid)
{
struct Rectangle r;
r.length=len;
r.width=wid;
return r;
}
double girth(struct Rectangle r)
{
return 2*(r.length+r.width);
}
double area(struct Rectangle r)
{
return r.length*r.width;
}
int main ( void ){
double len,wid;
double p,s;
struct Rectangle r;
printf("请输入一个矩阵的长和宽:");
scanf("%lf %lf",&len,&wid);
r=initRectangle(len,wid);
p=girth(r);
s=area(r);
printf("矩阵的长和宽:%lf %lf\n",r.length,r.width);
printf("矩阵的周长%lf\n",p);
printf("矩阵的面积:%lf\n",s);
}
程序显示错误:[Error] 'initRectangle' was not declared in this scope