
Teaching a 9 yr old QBasic
Quote:
>Decided it was time for my 9 yr old daughter to get acquainted with
>programming so dusted off my old copy of QBasic.
>Got her started with ideas about Variables and Literals, iterating with
>FOR loops, making choices with Logical operators, then getting it onto
>the screen in the way she wants.
>Now I want her to put some of these ideas into practice.
>All the elementary progamming examples I've got immediately move on to
>things like compound interest, basic statistics. It's all way over her
>head.
>So far the best I've come up with is generating a 'times table' matrix.
One I've used with 4th and 5th grade kids is to graph your first name
- on real graph paper (usually about 6 lines high and 4 to 6 columns
wide). Then write the PRINT statements to format the name on the
screen.
Then the fun part. Make an outer loop with a variable name of PAPER
and a range of 0 to 7, and an inner loop with a variable name of INK
and a range of 0 to 15. Use the variables to set the color of the
text each time through the loop.
FOR PAPER = 0 TO 7
FOR INK = 0 to 15
COLOR INK, PAPER
PRINT 'separator line
PRINT "JJJJJ OOOO H H N N
'top row of "JOHN" - you can picture the rest
PRINT 'separator line
'add some delay here so it doesn't scroll off the screen before it can
be read.
NEXT INK
NEXT PAPER
You can also clear the screen at the beginning of each color pair for
a different way of displaying the result.
Other additions are to use random numbers for PAPER and INK, to check
if PAPER and INK are the same color and change one of them, to adjust
the value of the INK variable on each line so that the displayed name
is a rainbow.
Have fun!
Visit my source code page at http://www.*-*-*.com/ ~johnecarter
Visit my favorite school at http://www.*-*-*.com/ ~addison