The C calculator!

A fully funcional terminal calculator written in C!

coded by yours truly :)

The power of C is immeasurable. It's the closest your going to get to your own hardware than assembly code. You pretty much have full control of memory and data flow with C. C++ is also the same, but its wayyyyyy more deep and complex with its never ending updates and libraries, ontop of its class system.

I dont want to be that one guy, but the more popular programming langauges like Java, python, Go, and javascript are much slower and bloated, so C and C++ would be ideal for speed. Although the speed with C is nice, the tradeoff is the human readability of the code itself, and the fact that if you mess up the syntax once, your entire program will just throw you an error and implode in itself. C is case sensitive in some places, so you really have to be careful with that.

Also, being able to control memory flow within your program is a blessing AND a curse. If you mismanage memory in the slightest, the compiler will scream at the top of its lungs telling you that you screwed up, while your program ceases to function.

Anyways, enough C talk. Here's my handy dandy little calculator :)

(feel free to copy/paste and run it yourself!)

(I had to take off the "<" and ">" signs off of the include statement at the top because HTML gets confused and thinks that im trying to start a new tag lol)

This is the output of the program

the rest of the programs output is showcased here as a gif

It's looks fairly simple, but under the hood it is quite complex. In the code above, I use a switch operator to do the calculations once the users input is saved in memory.

A switch statement essentially is a different kind of "if-else" statement.

The break syntax is used in a switch statement to end a case. The case is the thing that triggers the commands underneath. This is why a switch statement is so similar to a if-else statement.

the percentage signs in the print statements throughout the code tell the computer how to print the output of the program. I would HIGHLY recommend if your interested in learning the C langauge, to read "The C Programming Language: Second edition" book. It goes into great detail on the langauge and is great for anyone who is willing to put time into learning a new language. This book is considered the holy bible for C veterans, because it does a really good job on explaining concepts in C and how to put them into practice.

I myself am reading this book (I even have the physical copy!) and im less than halfway through it. I cant explain enough how good this book is. This language is so much fun to learn. I enjoy learning this langauge on my free time. It's great to learn if you are into the Linux world, and just in general becuase it makes learning other high level langauges wayyyy easier.

I'm actually super excited to continue learning this god-like language and I plan to make some cool stuff with it. Stay tuned!

zooming in on the programmers holy bible

-- Duckyboy