This is a simple command-line calculator written in C++. It allows users to perform basic arithmetic operations, including addition, subtraction, multiplication, division, and modulus.
- Supports the following operations:
- Addition (
+
) - Subtraction (
-
) - Multiplication (
*
) - Division (
/
) - Modulus (
%
)
- Addition (
- Handles division by zero safely.
- Run the program.
- Enter the first number.
- Enter the second number.
- Choose an operator (
+
,-
,*
,/
,%
). - View the calculated result.
Enter a number: 10
Enter a number: 5
Enter an operator (+, -, *, /, %): *
Result: 50
To compile the program, use the following command:
g++ -o calculator main.cpp
To run the program:
./calculator
- Add support for floating-point numbers.
- Implement additional mathematical functions.
Menna