This project implements a basic calculator application with modular functionality for addition, subtraction, multiplication, division, power, and remainder calculations. You can configure which features are included at compile time.
The calculator supports the following operations:
- ADD: Addition
- SUB: Subtraction
- MUL: Multiplication
- DIV: Division
- POW: Power
- REM: Remainder
You can choose which features to enable when building the project using the FEATURES CMake variable. Here's how:
-
Configure: Use the following command to configure the project with CMake, specifying the desired features:
cmake -S . -B build -G "MinGW Makefiles" -DFEATURES="<FEATURES>"
Replace
<FEATURES>with a space-separated list of the features you want to include. For example:cmake -S . -B build -G "MinGW Makefiles" -DFEATURES="ADD SUB MUL" # Enables addition, subtraction, and multiplication cmake -S . -B build -G "MinGW Makefiles" -DFEATURES="POW DIV REM" # Enables power, division, and remainder cmake -S . -B build -G "MinGW Makefiles" -DFEATURES="ADD SUB MUL DIV POW REM" # Enables all features
The
-B buildpart creates a separate build directory, keeping your source tree clean. The-G "MinGW Makefiles"part tells cmake to use MinGW as the compiler. -
Build: After configuring, build the project using:
cmake --build build
This will compile the code with the selected features enabled.
After building, the executable will be located in the build directory. You can run it from the command line:
build/BlaisePascal The calculator will present a menu of available operations based on your configuration. Follow the prompts to perform calculations.
Here's an example of how to configure and build the calculator with addition, subtraction, and multiplication enabled:
cmake -S . -B build -G "MinGW Makefiles" -DFEATURES="ADD SUB MUL"
cmake --build build
build/BlaisePascal # Run the calculator on Windows.- Feature Names: Ensure you use the correct feature names (ADD, SUB, MUL, DIV, POW, REM) in all uppercase.
- Spaces: Use spaces to separate the feature names in the
FEATURESvariable.
