help

i have to made a class of large integer. that is capable of storing and manipulating integers so big that they cannot be stored in the normal 32 or 64 bit storage of regular integers. The LargeInteger class stores these numbers in an array, that is dynamically allocated. but help me to make arthimatic operation for it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  class LargeInteger{

   int * number;
   int nd; //number of digits
   bool sign; //positive or negative (zero may be treated as positive)
public:
   //Constructors
   LargeInteger();//Default constructor
   LargeInteger(string);//the string here is the input number as string, and will include '-' if it is a negative number
   LargeInteger(const LargeInteger &);//copy constructor
   //Assignment operator
   const LargeInteger & operator =(const LargeInteger &);
   //Calulator Operations: pay attention to the return types and the types of parameters, you should know what they are what they are
   LargeInteger add(const LargeInteger&);//addition
   LargeInteger sub(const LargeInteger&);//subtraction
   LargeInteger mul(const LargeInteger&);//multiplication
   LargeInteger div(const LargeInteger&);//division
   LargeInteger rem(const LargeInteger&);//remainder
   //Output method
   string toString();//return number as string (put '-' on the left in case of negative number) 
};
Topic archived. No new replies allowed.