Well I made this program in like 2 minutes and it only works sometimes because of a memory error. I know the code is horrible. Can anybody help me.


Code:
ClrHome
Lbl 1
Disp "EQUATION
Input "A ",A
Input "B ",B
Input "C ",C
A*C->D
Goto 2
End
Lbl 2
randInt(-10,5)->E
randInt(-10,5)->F
If E*F=B
Then
Goto 3
Else
Goto 2
End
Lbl 3
If E+F=B
Then
Disp "",E
Disp "",F
Else
Goto 2
End
I believe this has all the functionality of your code.


Code:
ClrHome
Disp "EQUATION
Prompt A,B,C
AC->D
Repeat(EF=B or E+F=B
randInt(-10,5->E
randInt(-10,5->F
End
Disp "",E,"",F
Are both EF=B and E+F=B supposed to be true, or does it just need to be one of them? Also, don't forget about using Ans.


Code:

ClrHome
Disp "EQUATION
Prompt A,B,C
AC→D
Repeat EAns=B or E+Ans=B
randInt(-10,5→E
randInt(-10,5
End
Disp "",E,"",Ans
Yes they are both supposed to be equal. They have to multiply and equal b and ad to be B.
Then


Code:
ClrHome
Disp "EQUATION
Prompt A,B,C
AC→D
Repeat EAns=B and E+Ans=B
randInt(-10,5→E
randInt(-10,5
End
Disp "",E,"",Ans


I notice you never use D...
Yes Kerm they should be using =D on the part not B.
Fine then. Very Happy


Code:
ClrHome
Disp "EQUATION
Prompt A,B,C
AC→D
Repeat EAns=D and E+Ans=D
randInt(-10,5→E
randInt(-10,5
End
Disp "",E,"",Ans
So, why are you asking for the B variable then?


Code:
ClrHome
Disp "EQUATION
Prompt A,B,C
Repeat EAns=AC and E+Ans=AC
randInt(-10,5→E
randInt(-10,5
End
Disp "",E,"",Ans
burr wrote:
So, why are you asking for the B variable then?


Code:
ClrHome
Disp "EQUATION
Prompt A,B,C
Repeat EAns=AC and E+Ans=AC
randInt(-10,5→E
randInt(-10,5
End
Disp "",E,"",Ans


Congrats, you made it smaller, but a LOT slower. AC won't be cached and will be recalculated every loop. Keeping it AC->D, <blah>=D is an optimization on what you just did. So good job making it worse!
This is an eight line program, so it's not like it's going to take much of a speed hit Razz
burr wrote:
This is an eight line program, so it's not like it's going to take much of a speed hit Razz


Inside of a LOOP idiot, so yes, it WILL be a significant speed hit. The number of lines doesn't mean crap.
Yeah if an 8 line loop runs 100 times that is somewhat like 800 lines plus the small bit of time it takes to go back to the start of the loop.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement