Operator/= in Ratio Class is working in a wrong way
<p>Look at this code please:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class Ratio
{
    public:
        Ratio(int a=0, int b=1) : num(a), den(b) {}
        Ratio&amp; operator/=(const Ratio&amp;);
        void print() {cout &lt;&lt; num &lt;&lt; "/" &lt;&lt; den &lt;&lt; endl;}
    private:
        int num, den;
};


Ratio&amp; Ratio::operator/=(const Ratio&amp; r)
{
    num*=r.den;
    den*=r.num;
    return *this;
}

int main()
{
    Ratio x(1,2), y(2,5);
    y/=x;
    y.print();
}
</code></pre>

<p>after executing this code, (y) should be 5/4, I have calculate it several times by my hands! But in output after printing (y), it shows 4/5! It is inverted by it should not be!</p>

<p>Where is the problem with my code? really I have checked it several and several times and it seems it does not have any problem! It is a homework :)</p>
