2017년 3월 8일 수요일

calculator issue


I've been working with Scott's calculator, following this great tutorial  but I got an issue , well for me.

You press N1 + N2 = N3 and works great. But if you try something like  this :   N1+N2+N3 = calculator just remember last 2 numbers so in this case I just get  the result of N2+N3 .  So calculator it's not working with more than 2 operands (the last 2) . So it's necessary you click equals after 2 operands. SO how can I fix this? I've thinking and trying but nothing seems to work. Any help would be extremely appreciated :)

--
With the Math Blocks basic operands,display with    block + block    or block - block  or block x block.    By left clicking the blue box on the control, you can change that to allow:   block + block + block   or block x block x block x block x block       Knowing that might help.

You may have to save the result of the first to calculations, then do the second.    For instance, consider putting the result of N1+N2 into a global called TemporaryStorage.  Initialize TemporaryStorage to zero at the beginning of a calculation session.    so any the result  of N1+N2 = N1+N2+temporaryStorage  ; now temporaryStorage has the result of N1+N2   so, when you do  +N3, you might get    temporaryStorage + N3.

This is just a idea of how your logic might go.  Try some things.  When you arrive at a solution, come back and tell us what works.

Perhaps will read the post and have some ideas too?

Was this helpful?

--
Hey Steve, 
Thank you for your help, you gave me some ideas (the temporary result).. I guess I fixed this I added a new procedure

 I add this procedure to each operator button :D and it's working.  Thank you a lot. So now I'm able to get the result of adding any numbers when I press equals . So I can N1+N2+N3 -N4-N5=N6 or whatever jeje Remember please to check Scott's tutorial to fully understand this procedure  :D

--
Yes, Eduardo I had to figure out how to work around that.
So to do 3 + 4 + 6 you would do it this way:
3 + 4 =   (7 displays) + 6 =   (13 displays) etc. 

--
Hey Scott, that worked very well. I replace "," with "." and fixed the problem, So I took a pic if anyone want to see the blocks to use them :D, thank you very much Scott!
--

댓글 없음:

댓글 쓰기