BigInteger::setValue

Function


void setValue( const string& val );

Set BigInteger value. Input must in natural format.

Parameters

A string with the new value.

Return value

None

Example

#include <iostream> 
#include <string>
#include "HKUAL_BigInteger.h"
using namespace std;
using namespace HKUAL;

int main() {
    BigInteger bigInt( "10000" );
    cout << "bigInt = " << bigInt << endl;

    bigInt.setValue( "-10000" );
    cout << "bigInt = " << bigInt << endl;
    return( 0 );
}

Output

bigInt = 10000
bigInt = -10000

Time Complexity

, n is number of digits of the big integer.

© The University of Hong Kong Algorithms Library - hkual@cs.hku.hk