Skip to content

c8_natural

Dave Hudson edited this page May 2, 2017 · 5 revisions

c8::natural

c8::natural is a class designed to represent the natural numbers (zero and all positive whole numbers). Conceptually they behave in a somewhat similar way to unsigned int, but offer unlimited precision.

Constructors

Destructor

  • ~natural

Assignment Operators

Arithmetic Operators

Bitwise Operators

Compound Assignment Operators

Comparison Operators

Public Member Functions

Friend Functions

  • friend auto operator <<(std::ostream &outstr, const natural &v) -> std::ostream &

Examples

c8::natural allows us to create two large numbers, subtract one from the other, then output the result to std::cout:

c8::natural s0("5872489572457574027439274027101850990940275827586671651690897");
c8::natural s1("842758978027689671615847509102945571507457514754190754");

auto s2 = s0 - s1;

std::cout << s2;

See Also

Clone this wiki locally