• https://me.yahoo.com
COST (GBP)
2.09
0.00
0

# subtract

viewed 2074 times and licensed 54 times
Performs the subtraction of two long positive integers in the given base.
Controller: CodeCogs
Contents

C++
Excel

## Subtract

 std::stringsubtract( std::string a std::string b int base` = 10` )
This function calculates the subtraction of two long <em> positive </em> integers stored as character strings, in the given numerical base. The maximum number of digits of either of the numbers is only limited by the amount of memory available.

### Example 1

```#include <codecogs/maths/arithmetic/subtract.h>
#include <iostream>

int main()
{
std::string a("232342353"), b("73452344"),
c = Maths::Arithmetic::subtract(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
232342353 - 73452344 = 136670007```

### Note

The first number needs to be greater than the second, otherwise the function will exit.

### Parameters

 a the first number b the second number base Default value = 10

### Returns

a character string corresponding to the difference of the given numbers

### Authors

Anca Filibiu and Lucian Bentea (September 2005)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.