| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 842 人关注过本帖
标题:求助这道题(矩形定义和计算)
只看楼主 加入收藏
cj攵
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2021-3-28
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
求助这道题(矩形定义和计算)
#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
搜索更多相关主题的帖子: printf 矩阵 length double struct 
2021-03-28 17:10
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
收藏
得分:20 
如果你不信的话,那可以将其拷贝出来比较一下嘛
initRectange
initRectangle
2021-03-28 18:01
快速回复:求助这道题(矩形定义和计算)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015243 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved