Here - 1000 BiT

Here - 1000 BiT Here - 1000 BiT

11.07.2015 Views

Run 10000 REM ::: CLOCK :::10020TI$="120000":REM NOON10025 PRINT "clr"10029 PRINT "hm dn dn rt rt11;10030 PRINT LEFT$(TI$,2);II:";MID$(TI$,3,2);":";RIGHT$(TI$,2)10035 GOTO 10029You set the clock with an INPUT TI$. We used large line numbers so you can put theselines into programs which need a time of day clock. The clock runs off the "jiffy clock"and will stop during the time you do tape LOAD and SAVE.Assignment 26:1. Write a secret cipher making program. You give it a sentence and it finds how long itis. Then it switches the first letter with the second, third with the forth, etc. Example:THIS IS A TEST. becomes:HTSIISAETTS.2. Write a question answering program. You give it a question starting with a verb and itreverses verb and noun to answer the question. Example:ARE YOU A TURKEY?YOU ARE A TURKEY.3. Write a PIG LATIN program. It asks for a word. Then it takes all the letters up to thefirst vowel and puts them on the back of the word, followed by AY. If the word startswith a vowel, it only adds LAY. Examples:TURKEY becomes URKEYTAYADAM becomes ADAMLAY4. Write a program which speaks "double dutch." It asks for a sentence, then removesall the vowels and prints it out.5. Write a program which uses GET to get a letter A to C to use in a menu. Change theletter to a number 1 to 3. Then use the ON... GOTO command to pick which menuitem to do.6. Add to the clock program so the user can set it. You need anINPUT Tl$statement. Don't forget to help the user with PRINTed instructions.150

nnO INSTRUCTOR NOTES 27 SWITCHING NUMBERS WITH STRINGS^ This lesson treats two functions, STR$ and VAL. A general review of the concept of^ function is also made.r*)STR$ takes a number and makes a string which represents it.^ VAL does just the opposite, taking a string and making a numeric value from it. Itaccepts decimal and "scientific" notation (e.g., "1.2 E+31"). If the first character is not adecimal digit, or + or -, it returns the value "0". Otherwise, it scans the number,^ terminating at the first non-numeric character (other than the E of the scientific notation).r*)This interconversion of the two main types of variables adds great flexibility to programsinvolving numbers.r^ Functions return a value to the expression they are in. One also says that functions are"called" just as one calls a subroutine. The reason is, of course, that functions are^implemented as subroutines on the machine code level.QUESTIONS:^ 1. If your number marches too quickly in problem 2 of the assignment, how do you slow itdown?n2. If your program has the string "IN 1732 GEORGE WASHINGTON WAS BORN",r> write a few lines to answer the question "How long ago was Washington born?" (Youneed to get the birthdate out of the string and convert it to a number.)-^ 3. What is a value. What is meant by "a function returns a value"? What are some of thethings you can do with the value?n4. How do you convert the string "1999" to a number you can use in arithmetic?5. What is an argument of a function? How many arguments does the MID$( ) function~ have? How many for the CHR$( ) function?r*\6. Where in the line do commands always go? Can you put a function at the startof a line?O 7. What will you see if your program has the line:^65 PRINT Tl$n

nnO INSTRUCTOR NOTES 27 SWITCHING NUMBERS WITH STRINGS^ This lesson treats two functions, STR$ and VAL. A general review of the concept of^ function is also made.r*)STR$ takes a number and makes a string which represents it.^ VAL does just the opposite, taking a string and making a numeric value from it. Itaccepts decimal and "scientific" notation (e.g., "1.2 E+31"). If the first character is not adecimal digit, or + or -, it returns the value "0". Otherwise, it scans the number,^ terminating at the first non-numeric character (other than the E of the scientific notation).r*)This interconversion of the two main types of variables adds great flexibility to programsinvolving numbers.r^ Functions return a value to the expression they are in. One also says that functions are"called" just as one calls a subroutine. The reason is, of course, that functions are^implemented as subroutines on the machine code level.QUESTIONS:^ 1. If your number marches too quickly in problem 2 of the assignment, how do you slow itdown?n2. If your program has the string "IN 1732 GEORGE WASHINGTON WAS BORN",r> write a few lines to answer the question "How long ago was Washington born?" (Youneed to get the birthdate out of the string and convert it to a number.)-^ 3. What is a value. What is meant by "a function returns a value"? What are some of thethings you can do with the value?n4. How do you convert the string "1999" to a number you can use in arithmetic?5. What is an argument of a function? How many arguments does the MID$( ) function~ have? How many for the CHR$( ) function?r*\6. Where in the line do commands always go? Can you put a function at the startof a line?O 7. What will you see if your program has the line:^65 PRINT Tl$n

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

Saved successfully!

Ooh no, something went wrong!