FUNCTION
add
Performs the addition of two long positive integers in the given base.
You're viewing an older version of this page (#229). View the current version.
Interface
#include <codecogs/maths/combinatorics/arithmetic/add.h>
using namespace Maths::Combinatorics::Arithmetic;
This function calculates the addition of two long positive integers stored as character strings, in the given numerical base. The maximum number of digits of either the numbers is only limited by the amount of memory available.
Example:
#include <codecogs/maths/arithmetic/add.h>
#include <iostream>
int main()
{
std::string a("2323"), b("1747"),
c = Maths::Arithmetic::add(a, b, 8);
std::cout << "The following is a base 8 operation" << std::endl;
std::cout << a << " + " << b << " = " << c << std::endl;
return 0;
}
Output:
The following is a base 8 operation
2323 + 1747 = 4272
Parameters
a
the first term
b
the second term
base
Default value = 10
Returns
a character string corresponding to the sum of the given numbers
Interactive Calculator
a
b
base
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.