Sunday, July 26, 2009

Create a class in C++?

Need help to create this class:





Create a class in C++ named Fractions having two integer data members named for a fraction’s numerator and denominator. The class’s default constructor should provide both data members with default values of 1 if no explicit user initialization is provided. The constructor must also prohibit a 0 denominator value. Additionally, provide member functions for displaying an object’s data values. Also provide the class with overloaded operators that are capable of adding, subtracting, multiplying, and dividing two Fraction objects according to following formulas:








Sum of two fractions: a/b + c/d = ad+cb / bd





Difference of two fractions: a/b - c/d = ad-cb / bd





Product of two fractions: a/b * c/d = ad / bd





Division of two fractions: a/b / c/d = bd / cd

Create a class in C++?
duh...?
Reply:I had all of this but in spanish, my computer had kind of a melt down and now it has been erased. Sorry.


No comments:

Post a Comment