Jump to content

Photo

New Math Program


4 replies to this topic

#1 BuckoBrand OFFLINE  

BuckoBrand

    Space Invader

  • 47 posts

Posted Thu Mar 2, 2017 10:16 PM

Hi.Opry99er and I were coding a new program.Copy this and paste it onto Classic99.:

 

 

 

 

 

 

The thing is,it's more like a calculator than a program.You put in 2 numbers in into 2 variables and it adds them together.

 

Have fun! :)

 
100 CALL CLEAR
110 CALL SCREEN(16)
120 PRINT "THIS IS AN ADDITION PROGRAM"
130 PRINT :: PRINT
140 PRINT "ENTER TWO NUMBERS, AND THE":"PROGRAM WILL ADD THEM FOR":"YOU!"
150 PRINT :: PRINT :: PRINT :: PRINT "PRESS ANY KEY TO CONTINUE"
160 CALL KEY(0,K,S):: IF S=0 THEN 160
170 CALL CLEAR :: CALL SCREEN(12)
180 DISPLAY AT(20,1):"ENTER THE FIRST NUMBER"
190 INPUT NUM1
200 DISPLAY AT(10,10):NUM1;"+"
210 DISPLAY AT(21,1):"ENTER THE SECOND NUMBER"
220 INPUT NUM2
230 DISPLAY AT(9,14):NUM2;;
240 SUM=NUM1+NUM2
250 CALL CLEAR
260 DISPLAY AT(10,10):NUM1;"+";NUM2;"=";SUM
270 PRINT "PRESS ANY KEY TO ADD MORE":"NUMBERS"
280 GOTO 160
 
 
 
 
 
 
 


#2 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • 1,246 posts
  • Location:Beaverton, OR

Posted Fri Mar 3, 2017 12:23 AM

I like how it prints the equation as you are building it when you enter each number.

Does the ';;' at the end of line 230 do anything? or is that leftover from edits?

-M@

#3 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 8,261 posts
  • Location:Cookeville, TN

Posted Fri Mar 3, 2017 12:37 AM

Buck is asleep now.   :)

 

I don't think he meant to put those there in the finished program.  His plan here is to make a TI calculator for his sister, Daisy.  Tomorrow he is going to add subtraction and make a startup menu for the calculator while I am at work.

 

Really the only thing I had to help him with was lining up the DISPLAY on LINE 230.  He was trying to make it display the values onscreen, but when the PRINT rolled after the INPUT, it threw off the row value by 1.  It was frustrating him that it did not show up correctly, and I had to help him understand that the line had rolled up and he had to decrease his row value by 1 to make it line up.  He pretty much had the rest of it done.   :)

 

You'd think a 7 year old would want to work on games, but he spends most of his TI time these days playing with math functions.

 

Cool kid.   :)


Edited by Opry99er, Fri Mar 3, 2017 12:38 AM.


#4 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • 3,922 posts
  • Location:Denmark

Posted Fri Mar 3, 2017 1:52 AM

Nice work. If you use DISPLAY AT, then you might as well take a look at ACCEPT AT. ;)



#5 RXB OFFLINE  

RXB

    River Patroller

  • 2,765 posts
  • Location:Vancouver, Washington, USA

Posted Fri Mar 3, 2017 3:01 AM

 

Hi.Opry99er and I were coding a new program.Copy this and paste it onto Classic99.:

 

 

 

 

 

 

The thing is,it's more like a calculator than a program.You put in 2 numbers in into 2 variables and it adds them together.

 

Have fun! :)

 
100 CALL CLEAR
110 CALL SCREEN(16)
120 PRINT "THIS IS AN ADDITION PROGRAM"
130 PRINT :: PRINT
140 PRINT "ENTER TWO NUMBERS, AND THE":"PROGRAM WILL ADD THEM FOR":"YOU!"
150 PRINT :: PRINT :: PRINT :: PRINT "PRESS ANY KEY TO CONTINUE"
160 CALL KEY(0,K,S):: IF S=0 THEN 160
170 CALL CLEAR :: CALL SCREEN(12)
180 DISPLAY AT(20,1):"ENTER THE FIRST NUMBER"
190 INPUT NUM1
200 DISPLAY AT(10,10):NUM1;"+"
210 DISPLAY AT(21,1):"ENTER THE SECOND NUMBER"
220 INPUT NUM2
230 DISPLAY AT(9,14):NUM2;;
240 SUM=NUM1+NUM2
250 CALL CLEAR
260 DISPLAY AT(10,10):NUM1;"+";NUM2;"=";SUM
270 PRINT "PRESS ANY KEY TO ADD MORE":"NUMBERS"
280 GOTO 160
Hmm change line 120 
 
120 PRINT "THIS IS AN ADDITION PROGRAM": : :
 
And delete line 130 as unneeded. 
 
Next change line 140
 
140 PRINT "ENTER TWO NUMBERS, AND THE":"PROGRAM WILL ADD THEM FOR":"YOU!": : : :
 
Next change the line in 150
 
150 PRINT "PRESS ANY KEY TO CONTINUE"
 
This is a much cleaner code as a : after a PRINT is just like typing PRINT :: PRINT
 
 
 
 
 

 






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users