Skip to content

a calculator to perform basic mathematical calculations using c++

Notifications You must be signed in to change notification settings

Menna-MM/Basic_calculator_cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Basic Calculator in C++

Description

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.

Features

  • Supports the following operations:
    • Addition (+)
    • Subtraction (-)
    • Multiplication (*)
    • Division (/)
    • Modulus (%)
  • Handles division by zero safely.

Usage

  1. Run the program.
  2. Enter the first number.
  3. Enter the second number.
  4. Choose an operator (+, -, *, /, %).
  5. View the calculated result.

Example

Enter a number: 10
Enter a number: 5
Enter an operator (+, -, *, /, %): *
Result: 50

Compilation & Execution

To compile the program, use the following command:

g++ -o calculator main.cpp

To run the program:

./calculator

Future Improvements

  • Add support for floating-point numbers.
  • Implement additional mathematical functions.

Author

Menna

About

a calculator to perform basic mathematical calculations using c++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published