any one can help me...

Create a class Rational for performing arithmetic with fractions.
Take two private data members –the numerator and the denominator .Provide a constructor that enables an object of this class to be initializes when it is declared. The constructor should contain default values in case no initialization are provided and should store the fraction. Provide public member functions that perform each of the following tasks

a) Adding two and three rational numbers.(use function overloading)

b) Subtracting two and three rational numbers.(use function overloading)

c) Multiply two rational numbers.

d) Dividing two rational numbers.

e) Printing rational numbers, in the form a/b ,where a is the numerator and is the denominator

Have a go, then post what you have if/when you have some questions.
just wanna some help .m not getting what to do with it :>
I guess I'd start by thinking about what steps you have to go through when doing arithmetic with fractions. For example - adding 1/2 and 1/5 - you can't add them as they are, you need to get them under a common denominator first.

There's a section on overloading functions in the tutorial on this site.
http://www.cplusplus.com/doc/tutorial/functions2/

Do they mention anything about operator overloading?
Edit: http://www.cplusplus.com/doc/tutorial/templates/ includes operator overloading.
Last edited on
thanks .. now i'll try what to do ; :)
Topic archived. No new replies allowed.