#include <iostream>
using namespace std;
class box{
int dai,r,cao;
public:
friend istream& operator>>(istream&,box&);
friend ostream& operator<<(ostream&,box&);
int thetich(){
return dai*r*cao;
}
friend box operator+(box& b,box& c);
friend box operator-(box& b,box& c);
};
box operator+(box& b,box& c){
box a;
a.thetich()=(b.dai*b.r*b.cao)+(c.dai*c.r*c.cao);
return a;
}
box operator-(box& b,box& c){
box a;
a.thetich()=b.thetich()-c.thetich();
return a;
}
istream& operator>>(istream& s,box& a){
cout<<"\nnhap dai:";s>>a.dai;
cout<<"\nnhap chrong:";s>>a.r;
cout<<"\nnhap chcao:";s>>a.cao;
return s;
}
ostream& operator<<(ostream& s,box& a){
cout<<"the tich"<<;s<<a.thetich();
return s;
}
int main()
{
box a,b,c;
cout<<"nhap 2 box:";cin>>a>>b;
c=a+b;
cout<<"tong thetich:"<<c;
c=a-b;
cout<<"tong thetich:"<<c;
return 0;
}
Chả là em muốn cài đặt toán tử tính thể tích 2 hộp nhưng nó cứ bị lỗi như này, anh chị giúp e với
đề bài như này ạ____




83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?