Function
BigInteger();
BigInteger( const string& val );
Declare a BigInteger object.
Parameters
If a string val is provided, the BigInteger will be initialized to the given value.
Otherwise, the BigInteger will be initialized to be zero by default.
Return value
None
Example
#include <iostream>
#include <string>
#include "HKUAL_BigInteger.h"
using namespace std;
using namespace HKUAL;
int main() {
BigInteger bigInt0;
BigInteger bigInt1( "10000" );
string s = "-20000";
BigInteger bigInt2( s );
BigInteger bigInt3 = bigInt1;
cout << "bigInt0 = " << bigInt0 << endl;
cout << "bigInt1 = " << bigInt1 << endl;
cout << "bigInt2 = " << bigInt2 << endl;
cout << "bigInt3 = " << bigInt3 << endl;
return( 0 );
}
|
Output
bigInt0 = 0
bigInt1 = 10000
bigInt2 = -20000
bigInt3 = 10000 |
Time Complexity
O( number of digits of the big integer )
|