Author |
Message |
Homer_simpson

|
Posted: 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.
Description: |
|
 Download |
Filename: |
formula solver.t |
Filesize: |
2.45 KB |
Downloaded: |
713 Time(s) |
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Catalyst

|
Posted: Sun May 11, 2003 12:05 am Post subject: (No subject) |
|
|
it doesnt work
the order of operations isnt there it just reads left to right
|
|
|
|
|
 |
Tony

|
Posted: Sun May 11, 2003 12:14 am Post subject: (No 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).
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Catalyst

|
Posted: Sun May 11, 2003 12:14 am Post subject: (No subject) |
|
|
im gonna try to make something like this
|
|
|
|
|
 |
Homer_simpson

|
Posted: Sun May 11, 2003 10:37 am Post subject: (No subject) |
|
|
well i'm not done
but i'll look forward to fixing the operation order...
|
|
|
|
|
 |
Martin

|
Posted: Sun May 11, 2003 8:23 pm Post subject: (No subject) |
|
|
Check out Bugz' sybolic calculator
|
|
|
|
|
 |
Martin

|
|
|
|
 |
Asok

|
Posted: Sun May 11, 2003 9:07 pm Post subject: (No subject) |
|
|
that one doesn't filter the bedmas though ie.
1+2*3 = 7
the program will say 9
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Homer_simpson

|
Posted: Sun May 11, 2003 9:58 pm Post subject: (No 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....
|
|
|
|
|
 |
Asok

|
Posted: Sun May 11, 2003 10:14 pm Post subject: (No subject) |
|
|
x = -3
|
|
|
|
|
 |
Homer_simpson

|
Posted: Sun May 11, 2003 10:41 pm Post subject: (No subject) |
|
|
grrrrr... the calc doesn't give u that.....
|
|
|
|
|
 |
Asok

|
Posted: Sun May 11, 2003 10:53 pm Post subject: (No 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.
|
|
|
|
|
 |
Homer_simpson

|
Posted: Mon May 12, 2003 12:35 am Post subject: (No subject) |
|
|
bwahahahaaaaaa......
that's just dumb!!!! what if some1 enters the equation 3x=x-1000000000
|
|
|
|
|
 |
Asok

|
Posted: Mon May 12, 2003 6:42 am Post subject: (No subject) |
|
|
well like real-life calculators there can be a character limit.
|
|
|
|
|
 |
Homer_simpson

|
Posted: Mon May 12, 2003 12:18 pm Post subject: (No subject) |
|
|
that's true but first of all not all caclulators solve equations and the ones that do dont do it by guessing numbers...
|
|
|
|
|
 |
|