Representation and manipulation of rational numbers in C++
Requirements
Task is to define a class to represent and manipulate rational numbers (fractions), so that by simply changing the type of n1 and n2 to Rational the program will compute fractionalarithmetic expressions such as these:
1/2 + 1/3 // answer: 5/6
1/3 - 1/4 // answer: 1/12
2/3 * 4/5 // answer: 8/15
3/7 / 2/3 // answer: 9/14
Download the file fractions_0.zip, which contains the calculator code and a skeleton version of the Rational class. The class defines (but doesn't fully implement) appropriate constructors to initialise instances of Rational, extract and insert operators for input and output of Rational values, and of course arithmetic operators to compute the results.
Buy now
CONTACT DETAILS
For any other questions or other tasks please feel free to contact me
via email: mhassnainjamil@gmail.com
via WhatsApp: +92-324-7042178
via skype: hassnainjamil1
Comments
Post a Comment