c++的一个问题no matching function for call to 求解

#include<iostream>usingnamespacestd;classrectangle{doublewidth;doublelength;public:re... #include <iostream>
using namespace std;
class rectangle{
double width;
double length;
public:
rectangle(double w,double l);
rectangle(const rectangle& p);
void perimeter(double w,double l);
void square(double w,double l);
};
rectangle::rectangle(double w,double l){
width=w;
length=l;
}
rectangle::rectangle(const rectangle &p)
{ length=p.length;
width=p.width;
}
inline void rectangle::perimeter(double w,double l)
{ cout<<(2*width)+(2*length)<<endl;
}
inline void rectangle::square(double w,double l)
{ cout<<width*length<<endl;
}
int main(){
int n;
cin>>n;
double wid,len;
while(n--)
{
cin>>wid>>len;
rectangle p(wid,len);
p.perimeter();
p.square();
}
return 0;
}最后两行那里显示no matching function for call to 什么意思,求大神解救
展开
 我来答
4788665
2016-06-05 · TA获得超过105个赞
知道小有建树答主
回答量:128
采纳率:0%
帮助的人:97.3万
展开全部

p.perimeter();
p.square();

这两个调用的时候,需要传参数进去。改成

		p.perimeter(wid,len);
p.square(wid,len);

 


或者在main上边在加上两个没参数的函数

inline void rectangle::perimeter()
{ cout<<(2*width)+(2*length)<<endl;
}
inline void rectangle::square()
{ cout<<width*length<<endl;
}

匿名用户
2016-06-05
展开全部
你的现在输入的参数是string类类型,需要char*类型,可以使用string的c_str()成员函数来获得char*改成:if(strcmp(stu[j].num.c_str(),stu[max].num.c_str())>0)
追问
谢谢
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式