New datatype which can have numbers upto 100 digits.
- by ckv
Note: This was an interview question and may not have an actual use case currently
The question was to design a class that can store numbers which are very very large say each number can have 100 digits. This new class is a datatype like int.
What are the different types of constructors, overloads and other functions that you would write.
How can this be further extended to support really large floating point numbers.
How this can be given to others so that they can reuse the same component with their own additional functionality.
My answer consisted of 2 approaches
1. using array of integers to store every say 10 digits
2. using string itself to store the number and perform operations on individual numbers.
What would be the best approach?