Skip to content

This is a simple console-based calculator written in C. It is a tool with support for powers, roots, trigonometric functions, factorials, and a history of recent results. It also lets you reuse the previous result in new operations.

License

Notifications You must be signed in to change notification settings

Sandra1me/C-Console-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

C Console Calculator

This is a simple console-based calculator written in C. It started as a basic exercise to practice control structures, input/output, and error handling. Over time, it evolved into a more complete tool with support for powers, roots, trigonometric functions, factorials, and a history of recent results. It also lets you reuse the previous result in new operations.

Features

  • Basic operations: addition, subtraction, multiplication, division
  • Powers and roots
  • Trigonometric functions: sine and cosine
  • Factorials (only for positive integers)
  • Option to reuse the previous result
  • Displays the last 5 results in a history list
  • Input validation to prevent crashes
  • Input buffer cleaning to avoid invalid reads

Compilation

Use gcc to compile the program:

gcc calculator.c -o calculator -lm

Usage

Run the program from the terminal:

./calculator

Follow the menu instructions to select an operation. After each operation, you'll be able to decide whether to continue and whether to reuse the previous result. The calculator will also display a list of your last 5 results.

Example

Calculator Console

Future Improvements

  • Add more math functions like tangent or logarithms
  • Save result history to a text file
  • Improve the interface with a more visual menu system
  • Create a GUI version in C++ or another language

License

This project is licensed under the MIT Licence. Feel free to use, modify, or distribute it.

About

This is a simple console-based calculator written in C. It is a tool with support for powers, roots, trigonometric functions, factorials, and a history of recent results. It also lets you reuse the previous result in new operations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages