-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dafe5d
commit 93b59a5
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# StringCalc | ||
|
||
## Description | ||
|
||
Integers and other data types alike have a specific set of values which they can have. If you want to use bigger numbers than these data types offer, you will need a workaround. Strings can theoretically be infinite (practically they are limited by the maximum available memory space). This C++ library offers the ability to use strings and calculate equations with them as if they were numbers. | ||
|
||
At the moment, all implemented functions take positive _integers_ and return the calculated number as a string. The subtraction function will put a negative sign at the start of the string in case the result is negative. The input for all functions needs to be positive. | ||
|
||
## Example usage | ||
|
||
```cpp | ||
// Addition | ||
std::cout << "5 + 6 = " << StringCalc::add("5", "6") << "\n"; | ||
|
||
// Subtraction | ||
std::cout << "12 - 7 = " << StringCalc::sub("12", "7") << "\n"; | ||
|
||
// Multiplication | ||
std::cout << "8 * 11 = " << StringCalc::mult("8", "11") << "\n"; | ||
|
||
// Division | ||
std::cout << "10 / 5 = " << StringCalc::div("10", "5") << "\n"; | ||
``` | ||
|
||
## Planned features | ||
|
||
+ Function for fatorials --> n! | ||
+ Function for power --> base^exponent | ||
+ Functionality for calculation of binary strings (maybe even float and hex, not sure yet) | ||
+ Performance improvements: I want to take another look at the implementation to see if I can optimize some things | ||
|
||
# Licence | ||
|
||
This project is licensed under the [MIT Licence](https://mit-license.org/). See LICENCE file for more information. |