A simple command-line calculator that allows you to perform basic arithmetic operations.
Welcome to the Simple Calculator! This program enables you to perform basic arithmetic operations on two numbers. You can choose between addition, subtraction, multiplication, and division. The program will guide you through entering the numbers and selecting the operation, and then it will display the result.
-
Clone or download this repository to your local machine.
-
Open your terminal and navigate to the directory where the calculator files are located.
-
Make sure you have Node.js installed on your machine. You can download it from nodejs.org.
-
Install the required dependencies using the following command:
npm install
-
Start the calculator by running the following command:
tsc calculator.ts && node calculator.js
-
Follow the prompts to enter the two numbers and select the operation you want to perform.
-
The program will display the result of the selected operation.
The calculator is implemented using JavaScript and the inquirer
library for user input. Here's a brief overview of how the code works:
- The program prompts the user to enter two numbers and select an arithmetic operation.
- It validates the user's input and performs the selected operation.
- The result is displayed on the screen.
Feel free to explore the code and customize it as you see fit. You can extend this calculator by adding more complex operations or error handling.
Muneeb u Rehman