#include <iostream>
using namespace std;
class Fraction
{
private:
int x;
int y;
public:
Fraction(int x=0,int y=1):x(x),y(y)
{
}
friend ostream& operator<<(ostream& oss,const Fraction& f);
friend istream& operator>>(istream& iss,Fraction& f);
Fraction operator*(const Fraction& f);
bool operator==(const Fraction& f);
bool operator<(const Fraction& f);
};
ostream& operator<<(ostream& oss,const Fraction& f)
{
return oss<<f.x<<"/"<<f.y;
}
istream& operator>>(istream& iss,Fraction& f)
{
return iss>>f.x>>f.y;
}
Fraction Fraction::operator*(const Fraction& f)
{
Fraction ff;
ff.y=this->y*f.y;
ff.x=this->x*f.x;
return ff;
//return Fraction(this->x*f.y+this->y*f.x,this->y*f.y);
}
bool Fraction::operator==(const Fraction& f)
{
return this->x==f.x&&this->y==f.y;
}
bool Fraction::operator<(const Fraction& f)
{
return this->x*f.y<this->y*f.x;
}
int main()
{
Fraction f;
cout<<"please input Fraction x&y:"<<endl;
cin>>f;
cout<<f<<endl;
Fraction ff;
cout<<"please input Fraction x&y again:"<<endl;
cin>>ff;
cout<<ff<<endl;
cout<<"f<ff: ";
cout<<(f<ff)<<endl;
cout<<"f==ff: ";
cout<<(f==ff)<<endl;
}