Project 4: Arithmetic on Large Numbers
Due Friday, April 19, at 9:00 AM
For project 4, write a class that represents a large integer, and supports operations on it. Any size integer should be supported up to resource limits on the system (out of memory, etc). Methods:
- operator+
- operator-
- operator*
- operator/
- operator%
- operator<<
-
- to_string
It should support several constructors:
- uint64_t
- uint32_t
- int64_t
- uint64_t
If needed, a destructor should be defined as well, but you can omit this if you don't need one. See the large number adding demo from April 8 for a brief overview of how to accomplish operations on large numbers. A similar technique can be used for subtraction, multiplication, division, and modulus.
Internally, the number should probably be represented as a vector of uint32_t, but you can use a different representation if it appeals to you.
Extra Credit
The easy way to implement to_string is to return the number in hexdecimal, because then each piece can be converted individually and concatenated together. 30% extra credit is available on this assignment if your to_string function supports conversion to base 10.
Turning in the Project
Upload your completed project here. Name your file with your first and last name, like this: lastname_firstname_p2.cpp. So I would name project 2 long_seth_p2.cpp. If you have more than one file, put them together in a common type of archive, like zip or tar or something.