A minimal, lightweight, terminal based utility tool written in C++ to perform arithmetic and other advanced operations on complex numbers.
complex-calc-cpp is a minimal, lightweight, terminal-based calculator made using C++ for performing arithmetic and advanced mathematical operations on complex numbers.
It supports Cartesian Form (x + iy) and Polar Form (r ∠θ) and provides smooth menu based CLI interaction, colored output, and clean modular design.
Works in Two Representations
- Cartesian Form →
(x + iy) - Polar Form →
r ∠θ
| Arithmetic Operations |
|---|
Addition (+) |
Subtraction (-) |
Multiplication (*) |
Division (/) |
| Advanced Operations |
|---|
exponentiation or power (z, n) or ^ |
root extraction or n-roots (z, n) or √ |
conjugate (~) |
-
↔ Auto-conversion
(Cartesian → Polar)or(Polar → Cartesian) -
🗒️ Display results in both form (Cartesian Form And Polar Form)
-
🖍️ Colored CLI output (ANSI)
-
⏱️ Loading Animations (typing effect)
-
📦 Clean header-based modular implementation
-
C++17 compatible compiler
g++(≥ 7.0 recommended)clang++MSVC(withC++17support)
-
Terminal
- ANSI-compatible terminal (for colored CLI output)
cd ~/Desktopgit clone https://github.com/manakcodes/complex-calc-cpp.gitcd path-to/complex-calc-cpp/makemake runmake cleanThis project exposes a header-only complex number library. You can include it in your own C++ projects as follows:
#include "include/complexcalcpp.hpp"#include "include/complexcalcpp.hpp"
int main()
{
COMPLEX *A = new COMPLEX('A', 10.000, 20.000, MODE::CARTESIAN);
COMPLEX *B = new COMPLEX('B', 40.000, 60.000, MODE::CARTESIAN);
COMPLEX *sum = AddComplex(A, B);
COMPLEX *difference = SubtractComplex(A, B);
COMPLEX *product = MultiplyComplex(A, B);
COMPLEX *division = DivideComplex(A, B);
A->PrintComplex();
B->PrintComplex();
sum->PrintComplex();
difference->PrintComplex();
product->PrintComplex();
division->PrintComplex();
delete A;
delete B;
delete sum;
delete difference;
delete product;
delete division;
return 0;
}.
├── include
│ ├── complex.hpp
│ ├── complexcalcpp.hpp <- API header
│ ├── complexcore.hpp
│ └── utility
│ └── utility.hpp
├── io
│ └── io.hpp
├── Main.cpp <- entry point
├── Makefile
├── README.md <- you are here :)
└── tests.cpp <- testing
4 directories, 9 files
This project is licensed under MIT License.