This was the example discussed in class. It simply tests the non-Polynomial classes.
#include <iostream>
using std::cout; using std::endl;
#include "rings.hpp"
#include "mod.hpp"
#include "modp.hpp"
#include "rational.hpp"
#include "integer.hpp"
int main() {
Mod<short, 10> a(2), b(5);
Mod<short, 10> c = dynamic_cast<Mod<short, 10> &>(a*b);
Modp<long, 43> x(2), y(5);
Modp<long, 43> z = dynamic_cast<Modp<long, 43> &>(x / y);
Modp<long, 43> yi = dynamic_cast<Modp<long, 43> &>(y.inverse());
Rational<int32_t> r(2,3), s(5,4);
Rational<int32_t> t = dynamic_cast<Rational<int32_t> &>(r - s);
Integer<int32_t> m(5), n(-12);
Integer<int32_t> & o = dynamic_cast<Integer<int32_t> &>(m + n);
cout << a << " * " << b << " = " << c << endl;
cout << x << " / " << y << " = " << z << endl;
cout << "\tbecause " << y << "^(-1) = " << yi << endl;
cout << r << " - " << s << " = " << t << endl;
cout << m << " + " << n << " = " << o << endl;
Modp<long, 43> u(-6), v(6);
Mod<long, 43> & result1 = x + y;
Mod<long, 43> & result2 = u + v;
cout << '(' << x << " + " << y << ") + (" << u << " + " << v << ") = "
<< result1 + result2 << endl;
Mod<long, 43> result3 = x + y;
Mod<long, 43> result4 = u + v;
cout << '(' << x << " + " << y << ") + (" << u << " + " << v << ") = "
<< result3 + result4 << endl;
cout << "Attemting to create bad Modp\n";
Modp<short, 16> bad;
}