Here is my code . . .

class Fraction { double m_dNumerator, m_dDenominator; // Private by default public: double value() { return m_dNumerator/m_dDenominator; } Fraction() { m_dNumerator = 1; m_dDenominator = 0; } friend Fraction operator*(Fraction Fraction1, Fraction Fraction2); Fraction(double dNumerator, double denominator) { m_dNumerator = dNumerator; assert(denominator != 0); m_dDenominator = denominator; } }; Fraction operator*(Fraction& Fraction1, Fraction& Fraction2) { return Fraction(Fraction1.m_dNumerator*Fraction2.m_dNumerator, Fraction1.m_dDenominator*Fraction2.m_dDenominator); } int main() { Fraction pi(22, 7); Fraction phi(161, 100); Fraction sum = pi*phi; cout << sum << endl; return 0; }

There are too many compiler errors

so I'll include the first five . . .

Quote

|50|error: 'double Fraction::m_dDenominator' is private|

|76|error: no match for call to '(Fraction) (int, int)'|

|76|error: no match for call to '(Fraction) (int, int)'|

|77|error: no match for 'operator<<' in 'std::cout << sum'|

This post has been edited by **hulla**: 03 September 2011 - 01:45 AM