11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DELAY LOOPS<strong>Here</strong> is a way to slow down parts of the program. It is a "delay loop."Run this program:10 REM HIDE AND SEEK20 PRINT "clr"30 PRINT "HIDE!"40 FOR I =1 TO 2000:NEXT I50 PRINT "COMING READY OR NOT!"Line 40 is the delay loop. The computer counts from 1 to 2000 before going on to the nextline. It is like counting when you are "it" in a game of hide and seek.Try changing the number "2000" in line 40 to some other number.Each <strong>1000</strong> in the delay loop is worth about one second of time. Try this:10 REM --TICK TOCK --20 PRINT "clr"30 INPUT "WAIT HOW LONG"; S36T=S*<strong>1000</strong>40FORQ=1 TOT:NEXTQ45 PRINT50 PRINT S; "SECONDS ARE UP"Assignment 11B:1. Write a "slow poke" program which prints out a four word message with severalseconds between each word.2. Write a digital clock program. It uses a timing loop to count seconds. Input the presenttime in hours, minutes and seconds. The clock then counts seconds and prints themout When 60 seconds have gone by, add one to the minutes and put seconds back tozero. Same with hours. Run the clock a long time and adjust the timing loop so theclock keeps good time.68

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!