BigInteger::toString

Function


string toString() const;

Get BigInteger value in string format.

Parameters

None

Return value

A string with the BigInteger value.

Example

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

int main() {
    BigInteger bigInt( "10000" );
    string s1 = bigInt.toString();

    cout << "s1 = " << s1 << endl;
    return( 0 );
}

Output

s1 = 10000

Time Complexity

O(n1), for n1 is number of digits of the big integer.

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