rCalc is a Simple GUI Calculator

rCalc

rCalc is a simple calculator created as a hobby project to improve my C programming language knowledge and GUI creation skills. GTK3 toolkit is used to create the GUI.

rCalc preview

Features

  • Support the basic arithmetic operations and can calculate the square root and the power of a number.
  • Parentheses are supported.
  • Digital keyboard is supported (enter key can be used to display the result).
  • Wrong and malformed expressions are handled with error messages.
  • White spaces are recognized.
  • Error-free expressions are saved into the internal history.
  • Support deleting any character before the cursor's current position by pressing "⟲" button.
  • Display can be cleared by clicking on "C" button.

How to build

1) Build using Make

Download and install GTK3 Packages. Download and install GNU Make if it is not installed. Then change directory to downloaded repository and then type:

$ make

To remove the compiled files (which can be found in the obj/ directory) and the executable, just type:

$ make clean

2) Build manually

Download and install GTK3 Packages. Then change directory to downloaded repository and type:

$ gcc -o rCalc ./src/calc.c ./src/stack.c ./src/callbacks.c ./src/main.c -std=c99 -g3 -Wall -I./include `pkg-config --cflags --libs gtk+-3.0` -lm

And then execute rCalc:

$ ./rCalc
  • Note 1 : The compiled files (.o) will not be created when building manually.

  • Note 2 : Due to my decision to write the calculator only in plain C, I ignored the warning messages about using deprecated functions.

Usage

rCalc works like any calculator, it follows rules of operator precedence.

The minus sign '-' is unary, that is, to calculate a substraction, you MUST use parentheses for the number that is after the minus sign.

For example, to calculate 3.141-2.718, typing 3.141-2.718 is wrong, but 3.141-(2.718) or 3.141+(-2.718) gives a true result. 3-(sqrt(9)) gives syntax error while 3-sqrt(9) doesn't.

The multiplication sign '*' cannot be omitted. 3.141(2.718) or (3.141)(2.718) gives syntax error.

To display the precedent operation, click on the "⟲" button (the entry must be empty).

License

The MIT License (MIT) 2021 - ilrffy.

Similar Resources

A barebones single-header GUI library for Win32 and X11.

A barebones single-header GUI library for Win32 and X11.

luigi A barebones single-header GUI library for Win32 and X11. Building example Windows Update luigi_example.c to #define UI_WINDOWS at the top of the

Dec 30, 2022

Clight GUI written in Qt.

Clight GUI written in Qt.

CLight GUI Clight GUI written in Qt. Huge thanks to @FedeDP for writing Clight and Clightd, the daemons upon which this is built on.

Dec 21, 2022

YARA pattern matching scannner GUI

YARA pattern matching scannner GUI

YARA GUI This is a GUI for the binary pattern matching scanner YARA. Features Drag and drop targets Directory scanning Compiled rule cache Favorite/re

Jul 2, 2021

Proof-of-concept code to reconstruct the GUI of a Xen guest running Windows

Proof-of-concept code to reconstruct the GUI of a Xen guest running Windows

vmi-reconstruct-gui A proof-of-concept to reconstruct the GUI of a Xen VM running Windows 7. ❗ Disclaimer This repository is work in progress. It curr

Aug 21, 2022

Nvui: A NeoVim GUI written in C++ and Qt

Nvui: A NeoVim GUI written in C++ and Qt

Nvui: A NeoVim GUI written in C++ and Qt

Jan 7, 2023

✔️The smallest header-only GUI library(4 KLOC) for all platforms

✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

Jan 8, 2023

GUI for calibrating the wacom tablet to a screen or window

GUI for calibrating the wacom tablet to a screen or window

wacom-settings GUI for calibrating the wacom tablet to a screen or window. Learning project for writing in C. Uses GTK4 library for the GUI and X11 li

Oct 11, 2022

Python GUI for seeing what's happening inside a fuzzer

Python GUI for seeing what's happening inside a fuzzer

Fuzzwatch Fuzzwatch is a Python GUI made to show what's going on inside of a fuzzer. It is currently integrated with Manul, which is a coverage-guided

Nov 17, 2022

Low Latency GUI on top of Vulkan

Low Latency GUI on top of Vulkan

Low Latency GUI on top of Vulkan

Dec 26, 2022
Related tags
This is a collection of widgets and utilities for the immediate mode GUI (imgui) that I am developing for the critic2 GUI
This is a collection of widgets and utilities for the immediate mode GUI (imgui) that I am developing for the critic2 GUI

ImGui Goodies This is a collection of widgets and utilities for the immediate mode GUI (imgui) that I am developing for the critic2 GUI. Currently, th

Nov 19, 2022
It's a simple Canvas GUI for Unreal Engine 4 with mouse operation
It's a simple Canvas GUI for Unreal Engine 4 with mouse operation

ue4-canvas-gui It's a simple Canvas GUI for Unreal Engine 4 with mouse operation. Included elements: Rendering Text (left/center); Rendering Rects; Re

Dec 26, 2022
super duper simple gui for C, wrapping imgui and stb

super duper simle gui for C, wrapping imgui and stb You can use it as a static library with cmake. See the example directory for a complete example. E

May 19, 2022
raygui is a simple and easy-to-use immediate-mode-gui library.
raygui is a simple and easy-to-use immediate-mode-gui library.

raygui is a simple and easy-to-use immediate-mode-gui library.

Dec 30, 2022
Fast, flexible and simple GUI.
Fast, flexible and simple GUI.

MyGUI is a cross-platform library for creating graphical user interfaces (GUIs) for games and 3D applications. Website: http://mygui.info/ There you c

Dec 29, 2022
Purely native C++ cross-platform GUI framework for Android and iOS development. https://www.boden.io
Purely native C++ cross-platform GUI framework for Android and iOS development. https://www.boden.io

BODEN CROSS-PLATFORM FRAMEWORK Build purely native cross-platform experiences with Boden Website ⬡ Getting Started ⬡ API Reference ⬡ Guides ⬡ Twitter

Dec 27, 2022
Elements C++ GUI library
Elements C++ GUI library

Elements C++ GUI library Introduction Elements is a lightweight, fine-grained, resolution independent, modular GUI library. Elements is designed with

Dec 30, 2022
Minimalistic C++/Python GUI library for OpenGL, GLES2/3, Metal, and WebAssembly/WebGL
Minimalistic C++/Python GUI library for OpenGL, GLES2/3, Metal, and WebAssembly/WebGL

NanoGUI NanoGUI is a minimalistic cross-platform widget library for OpenGL 3+, GLES 2/3, and Metal. It supports automatic layout generation, stateful

Dec 28, 2022
A single-header ANSI C immediate mode cross-platform GUI library
A single-header ANSI C immediate mode cross-platform GUI library

Nuklear This is a minimal-state, immediate-mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed a

Dec 24, 2022
A library for creating native cross-platform GUI apps

Yue A library for creating native cross-platform GUI apps. Getting started Documentations FAQ Development Examples Sample apps (with screenshots) Muba

Jan 7, 2023