Song+Ken

code format="cpp-qt" /* Illogical implementation: Please take a look at others approach for inspirations. */

class rat{ protected: int n, d;     public: rat(int x, int y){n=x; d=y;}; ~rat{}; void dis{cout<f2.n)f3.n=n-f2.n;                 else f3.n=f2.n-n; f3.d=d*f2.d;

return f3; };     rat mul(rat f2) { rat f3(0,0);

f3.n=n*f2.n;                 f3.d=d*f2.d;

return f3; };     rat div(rat f2) { rat f3(0,0);

f3.n=n*f2.d;                 f3.d=d*f2.n;

return f3; };     }; code