Question : C++ HugeInt - trouble with size

I am having trouble obtaining the size of a HugeInt object.. (I want to eventually be able to compare to values)

I'm not sure if a convert (via another constructor) is needed or what. Would really appreciate help with this. Thanks

Please see below for for the two constructors..
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
HugeInt::HugeInt( long value )
:size(0)
{

   // initialize array to zero
   for ( int i = 0; i < digits; i++ )
      integer[ i ] = 0;   

   // place digits of argument into array 
   for ( int j = digits - 1; value != 0 && j >= 0; j-- )
   {
      integer[ j ] = value % 10;
      value /= 10;
   } // end for
 //???size = sizeof(value);

} // end HugeInt default/conversion constructor
HugeInt::HugeInt( const string &number )
:size(0)
{
  size = sizeof(number);

   // initialize array to zero
   for ( int i = 0; i < digits; i++ )
      integer[ i ] = 0;

   // place digits of argument into array
   int length = number.size();
//   int size = strlen( &number );

   for ( int j = digits - length, k = 0; j < digits; j++, k++ )
      if ( isdigit( number[ k ] ) ) //ensure that char is digit
         integer[ j ] = number[ k ] - '0';
} // end HugeInt conversion constructor

Answer : C++ HugeInt - trouble with size

I think your best bet (for these constraints) is to switch to WPF
Random Solutions  
 
programming4us programming4us