Coder Social home page Coder Social logo

prathampt / calc Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 98 KB

The Calculator is a tool designed to perform basic arithmetic operations on numbers. Unlike traditional calculators, it accepts input as strings and handles operations with an extended range of numbers. This solves the limitation of typical calculators that require inputs within a finite range.

License: GNU General Public License v3.0

C 100.00%
basic-data-structures binary-calculator c

calc's Introduction

We invite everyone to contribute to this repo...


Calculator

Overview

The Calculator is a tool designed to perform basic arithmetic operations on numbers. Unlike traditional calculators, it accepts input as strings and handles operations with an extended range of numbers. This solves the limitation of typical calculators that require inputs within a finite range.

Problem Statement

The main problem with conventional calculators is their restriction to a specific range of numbers for operations like addition, subtraction, multiplication, and division. The Calculator addresses this limitation by working with numbers, allowing users to perform operations on a broader range of numerical values.

Approach

Infix to Postfix Conversion

One of the key features of the Calculator is its ability to handle mathematical expressions in infix notation. The calculator converts the infix expression to postfix notation, a more suitable format for computation.

Doubly Linked List Storage

To store numbers, the calculator utilizes a doubly linked list data structure. This facilitates efficient storage and manipulation of digits. The input strings are converted into digit nodes and linked together to represent the numbers.

Operations

Addition

The addition operation involves traversing both linked lists, digit by digit, and performing addition. The result is stored in a new linked list.

Subtraction

Subtraction is implemented similarly to addition, involving subtraction on each digit pair. The result is stored in a new linked list.

Multiplication

Multiplication is achieved through a multiplication algorithm, utilizing the standard multiplication process but adapted for numbers.

Division

Division is implemented using a division algorithm, resembling long division in base-10 arithmetic.

Usage

To use the Calculator, provide the input as a string representing the mathematical expression. The calculator will process the input, perform the specified operation, and display the result.

License

This project is licensed under the GPL License - see the LICENSE file for details.

Feel free to customize this template according to the specifics of your project and include additional details or sections as needed.

Contributors:

Bhavya Shah

Pratham Tandale

calc's People

Contributors

bhavyabeliever avatar prathampt avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

bhavyabeliever

calc's Issues

where we should store the decimal part?

hello everyone, i had read the toNumber function and the issue i faced is we haven't handled the decimal part.
please decide about it.
Also please specify that why we have use doubly linked list instead we store the numbers in reverse order of singly linked list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.