#include<bits/stdc++.h>
using namespace std;
class tamgiac{
	float a,b,c;
	public:
		tamgiac(){
			a=b=c=0;
		}
		tamgiac(float x,float y,float z){
			a=x;
			b=y;
			c=z;
		}
		friend istream&operator>>(istream&x,tamgiac & y);
		friend ostream&operator<<(ostream&x,tamgiac y);
		bool operator*();
		bool operator==(tamgiac y);
};
istream&operator>>(istream&x,tamgiac & y){
	cout<<"canh a="; x>>y.a;
	cout<<"canh b="; x>>y.b;
	cout<<"canh c="; x>>y.c;
	return x;
}
ostream&operator<<(ostream&x,tamgiac y){
	cout<<"canh a="<<y.a<<endl;
	cout<<"canh b="<<y.b<<endl;
	cout<<"canh c="<<y.c<<endl;
	return x;
}
bool tamgiac::operator*(){
	return(a==b&&a==c&&b==c);
}
bool tamgiac::operator==(tamgiac y){
	float p1=(a+b+c)/2;
	float p2=(y.a+y.b+y.c)/2;
	float S1=sqrt(p1*(p1-a)*(p1-b)*(p1-c));
	float S2=sqrt(p2*(p2-y.a)*(p2-y.b)*(p2-y.c));
	return (S1==S2);
}
int main(){
	tamgiac A,B;
	cout<<"nhap thong tin tam giac A: "<<endl;
	cin>>A;
	cout<<"nhap thong tin tam giac B: "<<endl;
	cin>>B;
	cout<<"thong tin tam giac A: "<<endl;
	cout<<A;
	cout<<"thong tin tam giac B: "<<endl;
	cout<<B;
	ofstream f("tamgiacdeu.txt");
	if(*A){
		cout<<"tam giac A la tam giac deu"<<endl;
		f<<"tam giac A la tam giac deu"<<endl;
	}
	else{
		cout<<"tam giac A la tam giac thuong"<<endl;
		f<<"tam giac A la tam giac thuong"<<endl;
	}
	if(*B){
		cout<<"tam giac B la tam giac deu"<<endl;
		f<<"tam giac B la tam giac deu"<<endl;
	}
	else{
		cout<<"tam giac B la tam giac thuong"<<endl;
		f<<"tam giac B la tam giac thuong"<<endl;
	}
	if(A==B){
		cout<<"2 tam giac co dien tich bang nhau!"<<endl;
		f<<"2 tam giac co dien tich bang nhau!"<<endl;
	}
	else{
	    cout<<"2 tam giac ko co dien tich bang nhau!"<<endl;
		f<<"2 tam giac ko co dien tich bang nhau!"<<endl;
	}
	f.close();
	return 0;
}