求三个长方体的体积,大神帮忙看看哪里错了?
#include<iostream>using namespace std;
class TJ
{
public: void set();
void show();
void Tiji();
private:int length; //长方柱的长
int width ; //长方柱的宽
int height; //长方柱的高
int tiji ; //长方体的体积
};
void TJ::set()
{
cin>>length>>width>>height;
}
void TJ::Tiji()
{
tiji=length*width*height;
}
void TJ::show()
{
cout<<tiji<<endl;
}
int main()
{
int n,i;
cout<<"请输入要求的长方体的个数"<<endl;
cin>>n;
TJ t[n];
for(i=0;i<n;i++)
{
t[n].set();
t[n].show();
t[n].tiji();
};
return 0;
}