| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2753 人关注过本帖
标题:我的程序为什么会出现function does not take 1 parameters这样的错误
只看楼主 加入收藏
走自己路的人
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2007-4-17
结帖率:100%
收藏
 问题点数:0 回复次数:1 
我的程序为什么会出现function does not take 1 parameters这样的错误

#include<iostream.h>

class cfx

{
private:

float length;

float width;

public:

cfx(float l=1,float w=1):

length(l),width(w)

{}

~cfx()

{}

cfx zc(const cfx l)const;

cfx area(const cfx l)const;

void show(void)const;

float getLength(void)const;

float getWidth(void)const;

float setLength(void)const;

float setWidth(void)const;

};

float cfx::getLength(void)const

{ return length;

}

float cfx::getWidth(void)const

{ return width;

}

cfx cfx::zc(const cfx l)const

{ cfx c;

c=2*length+2*l.width;

return c;

}

cfx cfx::area(const cfx l)const

{ cfx c;

c=length*l.width;

return c;

}

void main(void)

{ cfx length(12),width(5),z1,z2;

length.setLength(11);

width.setWidth(6);

z1=length.zc(width);

z2=length.area(width);

cout<<"z1 is"<<z1.getLength()<<endl;

cout<<"z2 is"<<z2.getWidth()<<endl;

}

错误显示:D:\Program Files\Microsoft Visual Studio\MyProjects\Exam3_32\Exam3_32.cpp(78) : error C2660: 'setLength' : function does not take 1 parameters
D:\Program Files\Microsoft Visual Studio\MyProjects\Exam3_32\Exam3_32.cpp(80) : error C2660: 'setWidth' : function does not take 1 parameters

搜索更多相关主题的帖子: does function take parameters not 
2007-04-17 23:19
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
收藏
得分:0 

float setLength(void)const;

float setWidth(void)const;



你自己声明的函数参数表是空的,用的时候你又用上了参数,当然会错!


Fight  to win  or  die...
2007-04-17 23:33
快速回复:我的程序为什么会出现function does not take 1 parameters这样的错误
数据加载中...
 
   



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

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