Skip to content

SaifKhan21/BasicCalculator

Repository files navigation

Basic Calculator

This is a basic console calculator program written in C#. It allows users to perform basic arithmetic operations, view their recent calculation history, and run a set of automated tests.

Features

  • Supports addition, subtraction, multiplication, division, exponentiation, and square root calculations with both integers and decimals
  • Handles invalid inputs such as non-numeric characters, division by zero, and taking the square root of a negative number
  • Stores and displays the last 10 calculations performed
  • Contains a set of unit tests to verify calculator functionality

Getting Started

Prerequisites

To run this application, you will need the .NET SDK installed on your machine.

Running the Application

  1. Clone the repository or download the source code.
  2. Open a terminal or command prompt and navigate to the project directory.
  3. Run the following command to execute the application:
    dotnet run

The application will start, and you will be presented with a menu of operations to choose from.

Running the Tests

The project includes a set of unit tests to ensure the calculator is working correctly. To run these tests:

  1. Start the application using the dotnet run command.
  2. From the main menu, select option 8 to run the tests.

The test results will be displayed in the console, indicating at the end the number of tests that passed and failed.

Showcase

Full GIF

whole

Startup and Show Empty History

01-start

Addition

02-sum

Subtraction

03-subtract

Multiplication

04-multiply

Division

05-divide

Exponential

06-exponential

Square Root

07-squareroot

Show Recent History

08-showhistory

Run Tests

09-tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages