Inspiration
This is the latest programming challenge for me. I wanted to build the entire calculator myself, the user input, formating, parsing, and computation logic.
What it does
- Compute Simple Math (addition, subtraction, multiplication, division, parens)
- Computation can be up to 1000 characters long
- Computation will compute to an order of magnitude less than or equal to 1e9,999
- Application will format user input using a logic parser taking in only… a. Numbers 0 - 9 b. Operators [+, -, *, /] c. Parentheses (), Braces {}, and Brackets[]
How I built it
Test driven development... testCalculator(){
- compareCArrays()
- dispProgPurpose()
- getUserInput()
- displayUserInput()
- eliminateUserInputGarbage()
- formatUserInput() add opMath() and parenMath() functions to FormatingFunctions.cpp
- displayUserInput()
- calculateUserInput()
- displayAnswer()
Challenges I ran into
Hahahahaha.... passing in an array is the same as passing in a ptr... basically. I was trying to pass in a char array by reference. Not POSSIBLE. Don't need to.
That's the funniest one... the biggest challenge I overcame/realised is this. I started over three times, the third attempt is by far the longest attempt. The last attempt I had the goal of building code to meet test methods, and keeping my methods around 30 lines of code each (ish failing that still... way better than before).
Accomplishments that I'm proud of
Not giving up. I started this project Sept 17th last year and pretty consistently dumped time into it since then, minus october till december was slow.
What I learned
How to be patient and slowly chip away at my bigger projects.
What's next for Calculator
Finish the formating test method and the computation algorithm!!! I'm pretty excited to finish it and use it for robotics I want to build!
Built With
- cpp
Log in or sign up for Devpost to join the conversation.