read and do

Recommended Posts

I dont know if this is the right place to ask this but i have a gui in which you type a long problem, and an edit box below it to show the answer in the V formation, but im not sure if it can be done, like this:

If the problem is (3+4)*5/5-1 (what they type in)

and this is the result:

(3+4)*5/5-1

7*5/5-1

35/5-1

7-1

6

possible?

Edited September 18, 2006 by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post

Link to post

Share on other sites

I dont know if this is the right place to ask this but i have a gui in which you type a long problem, and an edit box below it to show the answer in the V formation, but im not sure if it can be done, like this:

If the problem is (3+4)*5/5-1 (what they type in)

and this is the result:

(3+4)*5/5-1

7*5/5-1

35/5-1

7-1

6

possible?

I don't know if it will always be incrementally shorter with each step (Decimals)

but that should be possible

Share this post

Link to post

Share on other sites

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post

Link to post

Share on other sites

I don't think there is a command that would make this incredibly easy.

The only thing that comes immediately to mind would be creating a function (probably recursive) to parse the expression as a string, and break everything down intelligently according to the order of operations. Evaluate each sub-expression and display as you go, then re-feed them.

Shouldn't be terribly hard to pull off.

Edited September 19, 2006 by yutt

It is a waste of energy to be angry with a man who behaves badly, just as it is to be angry with a car that won't go. - Bertrand Russell