Dummy C++ Package
-
class Calculator
A simple calculator class for basic arithmetic operations.
-
double add(double a, double b)
Add two numbers.
- Parameters:
a – First number.
b – Second number.
- Returns:
The sum of a and b.
-
double subtract(double a, double b)
Subtract one number from another.
- Parameters:
a – First number.
b – Second number.
-
double add(double a, double b)
Math Utilities
-
class Calculator
A simple calculator class for basic arithmetic operations.
Public Functions
-
double add(double a, double b)
Add two numbers.
- Parameters:
a – First number.
b – Second number.
- Returns:
The sum of a and b.
-
double subtract(double a, double b)
Subtract one number from another.
- Parameters:
a – First number.
b – Second number to subtract from the first.
- Returns:
The result of a - b.
-
double multiply(double a, double b)
Multiply two numbers.
- Parameters:
a – First number.
b – Second number.
- Returns:
The product of a and b.
-
double divide(double a, double b)
Divide one number by another.
- Parameters:
a – Numerator.
b – Denominator.
- Throws:
std::invalid_argument – if b is zero.
- Returns:
The result of a / b.
-
double add(double a, double b)
String Utilities
-
class Formatter
A class for formatting strings.
Public Functions
-
std::string surround(const std::string &text, const std::string &symbol = "*")
Surround text with a given symbol.
- Parameters:
text – The input string to surround.
symbol – The symbol to use for surrounding (default is “*”).
- Returns:
The formatted string with symbols surrounding the text.
-
std::string surround(const std::string &text, const std::string &symbol = "*")