Maybe more math than C++, but....

Printable View