Computer Science Canada Math formula solver... |
Author: | Homer_simpson [ Sat May 10, 2003 11:59 pm ] |
Post subject: | Math formula solver... |
the point of this program is to input a math formula and get the answer... it only works with */+- at the time but i'm working on brackets. |
Author: | Catalyst [ Sun May 11, 2003 12:05 am ] |
Post subject: | |
it doesnt work the order of operations isnt there it just reads left to right |
Author: | Tony [ Sun May 11, 2003 12:14 am ] |
Post subject: | |
ya, thats what I said earlier in my post... first you have to search your operations for any *s and /s... And do them first. Then resort your array and do left to right the way you have it now once only +- are left. let me give you an example 1 + 2 * 3 - 1 the result should be 6, though your program will output 8 now if you search for *s first... 1 + (6) - 1 after calculating 2*3 you store its value in the place of 2. Then you move the rest of your array down one spot to get rid of non existing *3 (since its already calculated). |
Author: | Catalyst [ Sun May 11, 2003 12:14 am ] |
Post subject: | |
im gonna try to make something like this |
Author: | Homer_simpson [ Sun May 11, 2003 10:37 am ] |
Post subject: | |
well i'm not done but i'll look forward to fixing the operation order... |
Author: | Martin [ Sun May 11, 2003 8:23 pm ] |
Post subject: | |
Check out Bugz' sybolic calculator |
Author: | Martin [ Sun May 11, 2003 8:25 pm ] |
Post subject: | |
http://www.compsci.ca/bbs/viewtopic.php?t=568 Bugz's probably the smartest person that I know |
Author: | Asok [ Sun May 11, 2003 9:07 pm ] |
Post subject: | |
that one doesn't filter the bedmas though ie. 1+2*3 = 7 the program will say 9 |
Author: | Homer_simpson [ Sun May 11, 2003 9:58 pm ] |
Post subject: | |
that is a good caclulater but my projects is a totally different thing when i finish it will be able to give you the answer to x = 2x + 3 I dont think that calc can do that.... |
Author: | Asok [ Sun May 11, 2003 10:14 pm ] |
Post subject: | |
x = -3 |
Author: | Homer_simpson [ Sun May 11, 2003 10:41 pm ] |
Post subject: | |
grrrrr... the calc doesn't give u that..... |
Author: | Asok [ Sun May 11, 2003 10:53 pm ] |
Post subject: | |
well for your program you could have a for loop running all possibilities from -1000 to 1000 and an if statement checking to see if it's correct. eventually you'll find the answer. |
Author: | Homer_simpson [ Mon May 12, 2003 12:35 am ] |
Post subject: | |
bwahahahaaaaaa...... that's just dumb!!!! what if some1 enters the equation 3x=x-1000000000 |
Author: | Asok [ Mon May 12, 2003 6:42 am ] |
Post subject: | |
well like real-life calculators there can be a character limit. |
Author: | Homer_simpson [ Mon May 12, 2003 12:18 pm ] |
Post subject: | |
that's true but first of all not all caclulators solve equations and the ones that do dont do it by guessing numbers... |