The following code example is taken from the book
Object-Oriented Programming in C++
by Nicolai M. Josuttis, Wiley, 2002
© Copyright Nicolai M. Josuttis 2002
// header files
#include <iostream>
#include "rfrac.hpp"
int main()
{
// declare reducible fraction
CPPBook::RFraction x(91,39);
// output x
std::cout << x;
std::cout << (x.isReducible() ? " (reducible)"
: " (non reducible)") << std::endl;
// reduce x
x.reduce();
// output x
std::cout << x;
std::cout << (x.isReducible() ? " (reducible)"
: " (non reducible)") << std::endl;
// multiply x by 3
x *= 3;
// output x
std::cout << x;
std::cout << (x.isReducible() ? " (reducible)"
: " (non reducible)") << std::endl;
}