Homework 5 Solution
In general, there are two important criteria for whether you "got" this assignment.
First, did you get the right answer for fact(300)? Check against the actual value here.
Secondly, and more importantly, did you code in idiomatic C++? Your factorial function should look almost identical to one you would write with a native number type (differing only in the argument and return types). For example: If your factorial function is packed with details about your specific number class you're probably not using operator overloading correctly.
Also, below you'll notice below that I side-stepped the whole messy issuing of deallocating mantissas by using a reference counting pointer. Another safe (slightly less efficient) option would be to store vectors by value. If, however, your mantissa was a naked array then you needed to implement the holy trinity: a copy constructor, a destructor, and an assignment operator.