English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

the engineering calculator

2007-06-07 20:43:56 · 5 answers · asked by bahare m 1 in Science & Mathematics Mathematics

5 answers

i did that project!
EXPLINATION! operands=1, 2, 3 , etc
operators=+ - / *
you need to use inverse polish notation for an equation cause that is how the computer does it. now you also need to have a sort of priority so that when you itterate the stack in which you store your operators you know what to do (mainly using cases).
so let's say you have something like 1+2+3*5/3. the first thing is that you say * and / are higher priority than + and -. so if 2 of the same operators come in the stack one after another you make the calculation with the operator which already was on the stack of operators betwen the last 2 operands and if a lower level operator comes on the stack of operators you do the previous operation on the operators stack after which you put on the operatros tasck the lower class operator that came! you need 2 stacks one for operators and one for operands. so let's see how taht would look like.
1+2+3*5/3
you read 1 and put it on the operands stack. you read plus you put it in the operator class. you read 2 you put it on the operand stack. you read plus....but the last element on the stack of operands is a + too (SAME CLASS OPERATOR) so what you do is make a plus operation (the 1st element in the operator stack which already was on the stack)of the last elements on the operands stack (last-1) and last and put the result on the operand stack and on the operator stack you only have a plus left the 2n plus that come in the equation.
you read 3 you put it on the operands stack. you read * and since it is higher priority you put it on the operand stack and don't do anything yet. you read 5 and put it on the operand stack and then you read / but you already have a *(SAME CLASS OPERATORS). so what you do is to do the * between the last two elements put on the operand stack and push the result on the operand stack. you read 3 and push it on the operand stack and now you are done with iterating the equation so what you do is do all the operations on the operator stack by taking the last 2 terms of the operand stack and pushing the result of the operation on the operands stack. when you finish itterating the operator stack all you ahve left is the final result in the operands stack.
i hope it helps!
if you need more help please say so by adding additional info to your question text.

2007-06-07 21:34:52 · answer #1 · answered by aleximas 2 · 0 0

I quote "GraphCalc has decided to release the sourcecode to the Windows version of GraphCalc 4.0alpha under the GNU General Public License (GPL)."

2007-06-07 21:02:08 · answer #2 · answered by Charley M 3 · 0 0

Sorry, yet it particularly isn't an elementary software. you want a form with code to create the form; you want buttons for the digits and for the calculation buttons; you want output code, and much greater. there isn't sufficient space in this dialogue board to even start to present day the code for a calculator. Sorry!

2016-11-27 01:36:48 · answer #3 · answered by ? 4 · 0 0

Probably. That seems to be what everyone is writing in these days.

Doug

2007-06-07 20:53:04 · answer #4 · answered by doug_donaghue 7 · 0 0

e=M Geek squared!

2007-06-07 20:47:10 · answer #5 · answered by 321 3 · 0 2

fedest.com, questions and answers