This is a simple implementation of a calculator using C. It provides basic and special mathematical calculations.
- Basic calculations: addition, subtraction, multiplication, division, and modulo.
- Special calculations: square root, cosine, sine, exponentiation, and logarithm.
- C compiler (GCC or Clang)
- Standard C library
-
Open a terminal or command prompt.
-
Navigate to the directory where the source files are located.
-
Run the following command to compile the code:
gcc *.c -o calc -lm
This command compiles all the
.c
files and generates an executable namedcalc
.
-
Execute the compiled program by running the following command:
./calc
-
The program will prompt you to enter your name and provide a list of available calculations.
-
Choose the type of calculation (basic or special) by entering the corresponding number.
-
Follow the on-screen instructions to input the numbers and operator for the calculation.
-
The program will display the result of the calculation.
To remove the compiled executable and object files, run the following command:
rm calc
The project contains the following files: Youngman-demo/ ├── main.h ├── calc.c ├── basic_cal.c ├── special_cal.c └── README.md
main.h
: Header file containing function prototypes and necessary library includes.calc.c
: Main program file that handles user input and performs calculations.basic_cal.c
: Source file containing functions for basic calculations.special_calc.c
: Source file containing functions for special calculations.
This is part of a demo project contribution for the Algorithmia.
This project is licensed under the MIT License.