注册 登录
编程论坛 C++教室

一个长方体问题

jerry931230 发布于 2007-06-30 23:22, 476 次点击

高手来看看


#include<iostream.h>

class square
{
private:
int length;
int width;
int height;
public:
square(int,int,int);
int input();
int volume(int,int,int);
}

square::square(int l,int w,int h):length(l),width(w),height(h){}

int square::volume(int l,int w,int h)
{
return(length*width*height);
}

int square::input()
{
cout<<"请输入三组长方体的长,宽,高"<<endl;
cin>>length>>width>>height;
}
int main()
{
square sy1,sy2,sy3;
sy1.input();
sy2.input();
sy3.input();
cout<<sy1.volume(int,int,int)<<endl;
cout<<sy2.volume(int,int,int)<<endl;
cout<<sy3.volume(int,int,int)<<endl;
return 0;
}

错在哪里!!

2 回复
#2
野比2007-06-30 23:32

cout<<sy1.volume(int,int,int)<<endl;

这是参数吗? 要用具体的值啊.. 别用数据类型..

#3
野比2007-06-30 23:34

int square::volume(int l,int w,int h)
{
return(length*width*height);
}

构造函数别返回值, 返回给谁?

1