Lỗi Process exited after 2.989 seconds with return value 3221225477 mọi người sửa lỗi giúp e với ạ
#include<iostream>
using namespace std;
class HinhVuong{
protected:
float dai;
public:
virtual void nhap();
virtual void in();
virtual int tich();
};
void HinhVuong::nhap(){
cout<<"Nhap chieu dai: ";
cin>>dai;
}
void HinhVuong::in(){
cout<<dai<<endl;
}
int HinhVuong::tich(){
int S;
return S = dai * dai;
}
class ChuNhat:public HinhVuong{
private:
float rong;
public:
void nhap();
void in();
int tich();
bool operator >(ChuNhat b);
};
void ChuNhat::nhap(){
cout<<"Nhap chieu dai:"<<endl;
cin>>dai;
cout<<"Nhap chieu rong:"<<endl;
cin>>rong;
}
void ChuNhat::in(){
cout<<dai<<", "<<rong<<endl;
}
int ChuNhat::tich(){
int S;
return S = dai * dai;
return S = dai * rong;
}
bool ChuNhat::operator >(ChuNhat b){
if(tich()>b.tich()){
return true;
}else{
return false;
}
}
int main(){
int n;
do{
cout<<"Nhap so luong phan tu:"<<endl;
cin>>n;
}while(n<=0 || n >= 40);
HinhVuong hv[n];
ChuNhat hcn[n];
for(int i = 0; i <= n; i++){
cout<<"Nhap hinh vuong thu "<<i+1<<endl;
hv[i].nhap();
}
for(int i = 0; i <= n; i++){
hv[i].in();
}
return 0;
}