Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Math formula solver...
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: 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.



formula solver.t
 Description:

Download
 Filename:  formula solver.t
 Filesize:  2.45 KB
 Downloaded:  695 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Catalyst




PostPosted: Sun May 11, 2003 12:05 am   Post subject: (No subject)

it doesnt work Sad
the order of operations isnt there it just reads left to right
Tony




PostPosted: 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).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Catalyst




PostPosted: Sun May 11, 2003 12:14 am   Post subject: (No subject)

im gonna try to make something like this
Homer_simpson




PostPosted: 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




PostPosted: Sun May 11, 2003 8:23 pm   Post subject: (No subject)

Check out Bugz' sybolic calculator
Martin




PostPosted: Sun May 11, 2003 8:25 pm   Post subject: (No subject)

http://www.compsci.ca/bbs/viewtopic.php?t=568


Bugz's probably the smartest person that I know
Asok




PostPosted: 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
Sponsor
sponsor
Homer_simpson




PostPosted: 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




PostPosted: Sun May 11, 2003 10:14 pm   Post subject: (No subject)

x = -3
Homer_simpson




PostPosted: Sun May 11, 2003 10:41 pm   Post subject: (No subject)

grrrrr... the calc doesn't give u that.....
Asok




PostPosted: 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




PostPosted: 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




PostPosted: Mon May 12, 2003 6:42 am   Post subject: (No subject)

well like real-life calculators there can be a character limit.
Homer_simpson




PostPosted: 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...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 15 Posts ]
Jump to:   


Style:  
Search: