static const int HUINTSIZE = 30;
HugeInt HugeInt::operator-( const HugeInt &op2 )//deberia ser const
{
HugeInt temp;
for( int i = HUINTSIZE - 1; i >= 0; i-- )
{
if( integer[ i ] < op2.integer[ i ] )
{
pP( integer, i );
temp.integer[ i ] = integer[ i ] - op2.integer[ i ];
}
else
temp.integer[ i ] = integer[ i ] - op2.integer[ i ];
}
return temp;
}
//funcion utilidad para operator-
void HugeInt::pP( short arr[], const int pos ) //pP (pedirPrestado), deberia ser const
{
for( int i = pos - 1; i >= 0; i-- )//for1
{
if( arr[ i ] > 0 )
{
--arr[ i ];
while( arr[ ++i ] == 0 && ( i != pos ) )
arr[ i ] = 9;
arr[ pos ] += 10;
break;
}
}
}// end pP (pedirPrestado) function