It works, but its design is a bit lack luster. Firstly, it seems to be nowhere near as simple as it could have been (I've been told I could have used a recursive descent parser or the shunting yard algorithm) and the code just seems jumbled. I think the algorithm I used is okay, though. It allows me to make use of stacks, vectors, string methods (eg. replace() ), pointers and doubles. I'll need to implement a better design though. Some member variables aren't private, some variables are unused and it just looks cramped.
I ought to point out the problems I'm facing with the use of doubles. Being floating point numbers, doubles will only allow the calculator to give the a certain degree of accuracy up to a point. Maybe I'll be able to use some sort of other datatype, but for now, I'll concentrate on the design.Greetings to all who have read the article and I welcome your reviews on my program :
http://codereview.stackexchange.com/questions/54273/simple-c-calculator-which-follows-bomdas-rules
If you'd like to download/examine my program more closely, use this: Download
No comments:
Post a Comment