/* viet chuong trinh nhap vao 2 phan so.Tinh tong ,tich,hieu,thuong*/
#include<iostream.h>
class phan_so
{ private:
int a,b,c,d;
public:
void set();
float tong();
float hieu();
float tich();
float thuong();
};
void phan_so::set()
{ cout<<"Nhap a,b,c,d:\n";
cin>>a>>b>>c>>d;
cout<<"phan so 1,2:\n";
cout<<(float)a/b<<endl<<(float)c/d<<endl;
}
float phan_so:: tong()
{ return ( (float)a/b+(float)c/d);
}
float phan_so::hieu()
{ return ( (float)a/b-(float)c/d);
}
float phan_so:: tich()
{ return ( (float)a/b*(float)c/d);
}
float phan_so:: thuong()
{ return ( (float)a/b/((float)c/d));
}
void main()
{ phan_so p;
p.set();
cout<<"tong cua 2 phan so:"<<p.tong()<<endl;
cout<<"hieu cua 2 phan so:"<<p.hieu()<<endl;;
cout<<"tich cua 2 phan so:"<<p.tich()<<endl;;
cout<<"thuong cua 2 phan so:"<<p.thuong()<<endl;;
}