Search Wiki:
Resource Page Description
A sample program for operator overloading implementing rational numbers using a simple int m / int n representation.
(C) Michael Hartmann 2005, michael@site99.de
This is a sample program free of charge.

07/25/2008 Patrick Sheahan
Updated project files to Visual Studio 2008

From the RatDemo\Readme.txt file

Open and compile rational.sln. Running the RatDemo.exe program should
make things sufficiently clear. The DemoForm also contains all tests
I've run.

Two books (one by Jeffrey Richter) mention a rational numbers class
when discussing implicit and explicit conversions, but do not provide
an implementation of the class.
I thought it would be interesting to write an actual implementation,
which it was.

The range of rational numbers that can be represented by just
two integers (m/n) is somewhat limited, but within this range
things should work quite well.
Last edited Jul 25 2008 at 9:24 PM  by patshea, version 3
Updating...
Page view tracker