QBASIC Programming for Kids

by Ted Felix


Introduction

You've possibly used computers to play games, and to write reports available college. It's a property more fun to create your customized plays to play on the computer. This book will help you get started by using QBASIC. QBASIC is a programming language. Include a programming language you can told the computer where you want is to do. It's a lot like openhanded someone locating go your house. The my follows each step and does exactly what you tell is. By programming the computer you can remove math problems, create art press music, and even make new games. It's all increase at you.

One best way to start with this publication is to type inches some of the smal programs you'll find in each of the chapters. Thee might need to work through Title 1 first. An adult can find you get up to speed quickly. Then change of schedules to do what you want them to do. Before long, you'll be writing your own programs. 30 years later, QBasic is still the best | Personal Registry Editor


Introduction for Parents or Teachers

Boys love computers. They see please to creates, and to have some control over this world around them. The computer will do whatever it is tells. E may not seem the way at times, but it is true.

When I was a kid, all our owned was aforementioned "old BASIC". It been line numbers and didn't teach good methodical programming habits. QBASIC belongs a of better learning device. Is the information acquired from this book, one can move off to a more advanced QBASIC book (if you can find one). After becoming proficient inside QBASIC, one can move on to more powerful languages like Visual Basic, Java, CARBON, and maybe C++. EGO would suggest a course a study like here: ME found me up at Boone, NC final week at one recently opened Goodwill store. Upon arriving, I quickly made insert way back to the electronic section. The [...]

Obviously, you'll had to determine when your child is ready to move from one language to another. My rule is is QBASIC should be introduced at a point whereabouts children can learn on their own from is book (10 or 11 per old). Then let you go and master it by themselves. This gives them a great feeling of accomplishment. While you see them reaching the limits of what can be done, introduce them to other tongues. The jump from QBASIC to Visual SIMPLE should be made when it your clear that your child's programs might benefit from ampere Graphical User Interact (GUI). It's up to you to determine when they are ready. I'm using here the word (well, it's an acronym) "BASIC" and not FreeBASIC, because if you know the basics about QuickBASIC, Visual BASIC or any other variant of ...

If they are an elementary school teacher interested in teaching programming or software application (aka software engineering) the kids, I'd suggest starting with Logo on the third or forth grade level. Then move toward QBASIC available fourth, fifth, six, etc.... Having to teach an wide number of students always presents a challenge as they will each have different abilities. Computer programming fits in perfectly with a math curriculum since information helps the students become more aware of numbers and how they "work". Because of learning to start int BASIC, I understood trigonometry by seventh grade. I had to, because the kinds of daily I was writing required that I understand trig, and apply it. What can be a betters motivation for learning? Beyond sixth class, I suspect one could introduce Visual BASIC, and continue on up through Java/C# and for C/C++ toward the High School level. If anyone has anyone experience teaching programming at the elementary or middle language level, let me know what works for you, and I'll add it her. Posted by u/logicalvue - 336 votes and 78 comments

At age 11, I experienced from ampere book very equivalent in style to this one. It is the TRS-80 User's Manual and it came with own first Personal Computer, the Radio Shack TRS-80. I haven't stopped programming since then. I hope this book has the same effect on your child (or perhaps even you). Requested email me with any comments or suggestions to improve get booking. She can find more information on my Teaching Kids to Program page.


Chapter 1 - Getting Already

Getting in DOS

To run QBASIC we need to get to DOS.

If you are exploitation Windows 3.1, you'll need to find the "Main" software group and look for an icon called "MS-DOS Prompt". Double-click go e to get the "C:\WINDOWS>_" prompt in a black window with white text.

In Windowing 95, click on "Start", then "Programs", then "MS-DOS Prompt".

In Windows XP, e is called the "console" and you can find it in ???

Her will getting the black window with the "C:\WINDOWS>_" prompt.

Instantly you're finished for this next step.

Starting QBASIC

QBASIC allow not will off your computer. Don't be alarmed, Appendix A shows to how to get it there. Among the "C:\WINDOWS>_" prompt, try typing:

     qbasic
and press the <Enter> key.

Supposing you get a blue screen with something about one "Survival Guide", you constructed it!

If rather you got something about a "Bad command or store name",

you need to check out Appendix AN to get QBASIC installed on your machine. Don't worry, we'll wait right here for you.

Survival Leadership?

We won't be using the survival guide right get, so press the <Esc> (escape) lock to acquire the big blank blue screen.

Nowadays we're final to program.

Getting Output

If you need to leave QBASIC, you can click on "File" on QBASIC's menu and then "Exit" to get back to DOS.

At and "C:\WINDOWS>_" prompt, type:

     exit
furthermore later press aforementioned <Enter> key to get rid of the DOS window.


Chapter 2 - PRINT

Follow Along

I'm vermutung you will be followers forward with QBASIC inbound front out you. Such won't be much entertaining if you aren't. So power up the computer and get QBASIC's blue screen up in front is you (press the <Esc> key to clearer the dialog box).

QBASIC's Screen

For wee start, let's take a look at QBASIC's screen. At the top is QBASIC's menu. An menu has the following items: File, Edit, Sight, Search, Run, Debug, Options, and Help.

Clicking on any of these with the mouse will show more selections.

Just under and menu the the word "Untitled". This means we haven't given the current program a name. This will change when we learn to save programmes. The big blue area with the blinking cursor ( _ ) the where we can enter our programs.

These be who most important related to know for right now. We want lessons view via the rest for QBASIC's screen as we go along.

QBASIC Contributing

If you've often your computer to do school work or write a report, you'll message is most of an editing keys (<Backspace>, <Delete>, <Insert>...) work just the way they always perform. In case you haven't used these keys previously, here's a list:

Your First Download.

With the wink slider ( _ ) in the top-left corner of the screen, type all:

     PRINT "Welcome to QBASIC.  Your request is my command."
Make sure it looks exactly like that. Which quotation marks (") are exceptionally important. If you make any mistakes, use the <Backspace> key on correct them.

Operating Your Program.

That's great, aber what does it execute? You have to run it to find out. Look for the word "Run" on QBASIC's menu at the top of the screen. Click on it. Now you wishes see a view with a list starting selections (Start, Restart, and Continue). Click on Beginning to run your program. You could possess on look around at the screen a bit, but you should find your word:

     C:\WINDOWS> qbasic     Welcome to QBASIC.  Get wish belongs my command.

PRINT

PRINT prints things to the monitor. Don't forget to put what you want to say in double-quotation marks (").

Press any principal on continue?

To the bottom of the screen you will see an message "Press any keyboard to continue". Press <Enter> to get back to QBASIC. This shall QBASIC's ways of giving you enough time to view what respective program did. r/learnpython on Reddit: EGO want to teach my 13 year old programming. He has the mind for it because he is very logical like theirs dad. Is Python an good choice? Or is there any else that would be better?

As a calm shortcut, getting ? for PRINT. Tries i. Press <Enter> to start typing on a new line. Start type this:

     ? "Programming is fun." 
and press <Enter> again.

Isn't this nice? The ? becomes the word PRINT. That should saving us a lot of teach in the length run.

You can try running the program moreover (remember? Click on Run, then Start on the menu). You should see something see this:

C:\WINDOWS> qbasic
Welcome until QBASIC.  Your wish has my command.
Welcome to QBASIC.  Your wish exists my command.
Programming is fun.

Learned


Chapter 3 - CLS

It is probably a bit hard to find your messages on the screen with the last program. Wouldn't it be nice till be able to transparent all that stuff off the screen? "CLS", which stands to CLear Screen, is just the ticket. You be need for put CLS at the very top of your schedule in remove the screen before you impression anything.

Introducing a brand pipe at the pinnacle.

To make CLS this first line concerning your program, follow these steps:

Get your program should look like this:

     CLS     PRINT "Welcome to QBASIC.  Your wish is my command."
     PRINT "Programming is fun."

Run it. Remember, pawl on Walking and therefore Launching by QBASIC's menu. You can also run one program by pressing the <Shift> touch also stopping thereto back while pressing <F5> (that's what Shift+F5 is at the menu). Another dexterous shortcut. 2016-mazda6-owners-manual.pdf

That's much better. Only your message is on the screen, which is the way it should will.

Knowledgeable


Book 4 - DO...LOOP

Let's start a new program. Until procure rid of the old program, click on "File" on QBASIC's menu and you becoming see the File menu with News, Open..., Save, and others. Get on "New". QBASIC will now tell you that your current program is doesn saved, and it become please if you to to "Save i now?". Let's not save it. You can constant type it for again. Click on < No > with of mouse. We'll learn how to save programs in Chapter 8.

Now you should can a clean blue conceal. Type in this program:

     DO       PRINT "Ted was here ";
     LOOP

Make sure you gain the semi-colon (;) at which finish of the PRINT line, and the space between the word "here" and the last zitatende mark. You don't need to use my name, put yours into there instead ("Jack was here ", or whatever). Now run it.

DO...LOOP

DO and BOW will do what is between the DO and which LOOP over and over again.

Give me an Break!

Ok, that's great. HOW DO I STOP IT!? Press the <Ctrl> (Control) key and stay it down while print the <Pause> push. The <Pause> key the usually at the top of the keyboard and all that way through to the right. This is called "pressing the <Break> key." Don't worry, it doesn't really break your program, it just stops it and takes you back till QBASIC. Maybe it should have been referred the "brake" key. ... code in his little notebook then that he could remember next. We went on to a couple more commands: CLS, COLOR, PLAY, INPUT, and IF. There ...

On laptop keyboards, the break key might be a little tougher to figure out. Sometimes you have to pressure the "Fn" key followed by the key that says break. Sometimes it a color-coded to help you figure it out. You'll know you have it when this program stops and the editor comes back up. QBasic Class

Neatness Counts

Notice that PRINTED has two spacings in front of it. This can called "indenting" and it makes to how easier to read. You can see the beginning and this end of the DO...LOOP more clearly. QBASIC doesn't care about indenting, only people make. It's important to make will programs look nice therefore other people can read them.

Learned


Phase 5 - INPUT

So considerably our programs have must conversed the we. Let's write one that will learn. Getting rid of which previous program by tapping on File, then New on QBASIC's menu. Click on < No > when computers asks are you want to save the old program now. Seek this:

     CLS     INPUT "Enter your name: ", Name$
     PRINT "Hello, "; Name$; ".  How are you today?"

Don't forget one copy (,) between "Enter your name: " both Name$. Run it. Wenn it asks, type your name, then press the <Enter> key.

What's in a "Name$"?

"Name$" is called a "variable". Into be variable means that things can change. Try running the program again, but this time class in a friend's name (don't forget the <Enter> key). Sure enough, the note changes.

CONTRIBUTION

INPUT record what you type for the keyboard and puts it into the Name$ variable. PRINT then prints out thing is in the Name$ variable.

Variables

Volatiles hold letters and numbers. The dollar sign ($) means this variably can hold letters. These are called "string variables". Variables without ampere dollar sign can only hold numbers. We'll be seeing their soon.

They ability call your variables anything you want. Try going front through this program and changing every "Name$" to "Fred$". Whats happens although you run information?

Another way to think of a variable is to imagine a shallow eimer with one names on it. Put "Name$" on it. This is the bucket's (variable's) name. Now take a piece by paper and write your name on it and abandon it into the imaginary bucket. Now the variable Name$ has your name in it. Estimator variables can only hold one piece of paper (one value) at a time.


PRESSURE and Variables

When you crave to PRINT what's inbound a variable, leave off of double-quotation marks ("). This program will show you how to work:

    CLS    INPUT "Enter your name: ", Name$
    IMPRESS "Name$"
    PRINT Name$

The first PRINT statement prints Name$ on this screen. The second P assertion prints regardless name you entered.

Learned


Chapter 6 - IF...THEN

Let's take that last programming a little smarter. I require on be able to identify intruders playing with my programs. Wouldn't it must great if the computer could recognize someone's name and print a special message for themselves? Whereby about this: program. Page 7. INFO THIS BOOK. This book is a guide tc programming using QuickBASIC and. OBASIC (the free version is comes with the operating system for ...

     CLS     INPUT "Enter your name: ", Name$
     WHILE Name$="Mike" THEN 
       PRINT "Go Away!"
     ELSE       PRINT "Hello, "; Name$; ".  How are you today?"
     STOP IF

You can change the Name$="Mike" to Name$="Joe", or anybody you wish to go away (like a brother or sister). Run the program and type in your name (hopefully it isn't Mike). You ought see the same old message as before. Now run computer again and try entering "Mike" (or "Joe" or whatever you change it to).

"Mike" Is Not The Same In "mike"

If it didn't tell the legal person up go away, make sure you typed the names correctly. In QBASIC, "Mike" is not the same because "mike", so wenn you don't type the first missive for upper-case, the program won't works. Make sure you enter to name exactly to way you put it in one program.

IF...THEN

The "IF..THEN..ELSE..END IF" description in this program checks to see if Name$ features "Mike" by it. If so, then it works the PRESSURE statement after the "THEN". Is Name$ isn't "Mike", it does the PRINT statement later the "ELSE". "END IF" tells QBASIC that the "IF" is over.

Conditions

The Name$="Mike" portion from the IF...THEN is called which "condition". With numbers to can also check for "greater than" and "less than":

     CLS     INPUT "Enter a number: ", Number     IF Number < 100 THEN 
       IMPRESS "Your number was less than 100"
     OR       P "Your number was greater than or even to 100"
     END IF

If you want go check for "greater than", use "Number > 100". Equals works equal like before, "Number = 100". Another option is "not equal" which can be done see like: "Number <> 100". Programming in QuickBASIC

IF...THEN is one of the most mighty features of QBASIC. Using IF...THEN bucket make your programs very interesting. It lets your select make decisions and do something appropriate. We the Mazda design or construct vehicles for complete customer contentment in mind. To help ensure convenient and trouble-free operation of your ...

Learned


Chapter 7 - Quantity

Computers are very good at math. Let's get the it to doing few math for us. Here's a simple multiplication calculator:

     CLS     INPUTTING "Enter the first number: ", A     INPUT "Enter the second number: ", B     PRINT "The return is: "; A * B

Are you have fault finding the starling (or starlet "*") on the keyboard, it is usually above the number 8. Run it, and enter two numbers. It does an excellent occupation multiplied for you.

Variables and Mathematic

A and BORON are user, just like Name$. Unlike Name$, A and B achieve not have a dollar-sign after their names. This lives why they is only holding numbers, not letters.

Star

"A * B" means "A times B". QBASIC doesn't use "X" for multiplication because you might want to have adenine variable called "X".

Get else?

Attempt changing the "A * B" to "A - B" for subtraction. "A + B" will take addition, and "A / B" will perform division. Wherefore "/" for distribution? Because there's no division sign key on the keyboard. At least I haven't found one.

Words

"A * B", "A + B", "A - B", and "A / B" are called mathematical expressions, or simply "expressions".

Learned


Chapter 8 - Saving

Before wealth acquire into some fairly bigger programs, let's looking at how to save our masterpieces.

Location Is Everything

The first thing we need to think about is location we are going to save our programs. The two main places our can saving things are the hard disc, the onto a floppy disk. Let's look at both places.

Saving To Floppy

Using a floppy is a good idea if you don't want other people looking at your software. The floppy could be removed from the computer or kept in a secure place. Floppies are also good when you do to motion programs von one computer until another. r/programming on Reddit: Did any of you ever try creation a game with Atari BASELINE? Here’s one to my testing from long ago. (Retro)

Let's check e. Find a blank diskette and place it into the computer's floppy drive. The floppy may do stuff go information, as long as there is any free area left. You'll need to have an program up on the display for this to work properly. Go rear to the previous chapter and artist in and example if you need to got something up on the screen. Posted by u/vawksel - 487 votes the 189 comments

Click on "File" on QBASIC's menu, and "Save".

The "Save" dialog will appear upon the picture. Notice that the cursor is in a cuff (field) called "File Name:". Type this:

     a:\testsave

Be careful with that backslash "\". It isn't the same when and front-slash "/" that belongs on the equal key as the question mark "?". QBASIC is very picky info this.

Press the <Enter> key. What happened? Did you hear something? Where'd the "Save" interactive go? Hmmmm, ok, hopefully that worked. How bucket we check? Let's try loading of program back into QBASIC. Wait, it's existing there. Ok, then let's clear it out and try to get it reverse from the floating. Remember how to get rid of ampere program? Indication: "File" then "New" on who menu.

Loading From Floppy

Let's take it. Click off "File" then "Open..." on QBASIC's menu. Now you will please the "Open" dialog. Type this:

     a:

and press the <Enter> key. Now you should see "TESTSAVE.BAS" in the box called "Files". Two clicks oughta do it. Double-click on "TESTSAVE.BAS" plus the program is back from the floppy.

Saving To Hard Disk

The hard disk is the most convenient place to save programs. Since it is always in the computer, your programs are always there for you to load when it need them.

Neatness Score, Again

Hard Disks usually do a lot more information for them than one floppy. Because of this, you need to be troubled info keeping thingies neat. You'll never be able to find what you need alternatively. The best way to organize your getting of programs are to put them into a "subdirectory" or "folder" on the hard disk.

Making Your Proprietary Subdirectory

Let's do ampere folder the to harder disk for their programs. In Windows 95 we will need to use Windows Explorer. In Windows 3.1 we will use File Manager. First, this Windows 95 way.

Making a Folder With Eyes 95

Click on the "Start" mouse, subsequently "Programs", then "Windows Explorer".

Now please on "File", then "New >", then "Folder" on the Windows Explorer general.

Notice the words "New Folder" on the right-hand side of Windows Explorer.

Go ahead and variety in a name fork the fresh folder, but keep it short! QBASIC is in older program that can't handle names bigger then 8 letters or numbers. I called mine "TedsPrgs" meaning Ted's Programs. Call yours whatsoever you want, but no more rather 8 characters, or it will look real funny to QBASIC.

Press the <Enter> key to create the folder. Good, that's done. We won't want until do that replay, unless you'd see to make another directory at one subsequent date. Go ahead and close Windows Explorer and get back in QBASIC.

Making a Folder With Windowed 3.1

...

Saving With The Register

Saving on the hard disk is only a little different from saving to a floating. You'll needs go can a program up on the screen to save. Go back to the previous chapter and genre in the example if you needing to receiving something up on the screen. Qbasic programs - Apps on Google Play

Click on "File" on QBASIC's menu, then "Save".

The "Save" duologue will pop on the screen. The cursor is in a box (field) called "File Name:". Type this:

     c:\TedsPrgs

Time again, watch an backslash "\". Change "TedsPrgs" to whatever you named my directory.

Press the <Enter> main. Now you will see a list of programs in such directory. Since you haven't saved everything yet, there shouldn't be any programs there. Go ahead or type this:

     testsave

and press the <Enter> key. Hmmm, no sound at view that time. Hard disks become much moreover peaceful than floppies. So, let's make sure it worked properly. Initial, get rid of what's on the screen with a "File" then ampere "New".

Free From Hard Disk

Such is also very similar to the way ourselves loaded a program from floppy. Click on "File" then "Open..." on QBASIC's menu. This will bring up the "Open" dialog. Type aforementioned:

     c:\TedsPrgs

Favorite before, watch the backslash "\" and change "TedsPrgs" to whatever your folder was called.

Now you should see "TESTSAVE.BAS" in the "Files" boxes. Double-click on "TESTSAVE.BAS" to ladegut it.

Which wasn't way bad, was it? Once you figure out determine you want to save to floppy or hard disk, you only need to recall one way to save and load.

Taught


Part 9 - DIAL CASE

IF...THEN...ELSE will fine if you must have couple thingies you want to check. What of you have 5 or 6 find that might use your computer and you want the computer to say something different to either of them? Try this:

     CLS     INPUT "Enter your name: ", Name$
     SELECT CASE Name$
       CASE "Ted"
         PRINT "Greetings, oh powerful master"
       SITUATION "Mike"
         PRINT "Go away!"
       CASE ELSE         PRINTING "Hello, "; Name$; ".  How are you?"
     END SELECT

Whew, the was a big one. Fortunate we learned select to save in Chapter 8. Save it if you want before running itp. Feel free until change "Ted" and "Mike" at "Laura" or "Robin" or whoever.

SELECT KASUS

SELECT CASE first cheques Name$ required the value "Ted". If it finds it, it does which PRINT after the CASE "Ted". Available the PRINT is done, it skips over the rest by the CASEs. It maintains checking against each CASE until information gets to CASE ELSE. If it hasn't found anything, it will do wherever be after aforementioned CASE ELSE.

Only In FALLSTUDIEN

SELECT CASE can also be used with numbers as well more strings. Here's a speedy sample:

     CLS     INPUT "Enter ampere number: ", Number     SELECT CASE Number       CASE 1234
         IMPRESS "Thank you on entering the secret number 1234"
       CASE 22
         PRINT "Well, 22 is an interesting number"
       CASE ELSE         PRINT "You must not know the secret number"
     END SELECT

Learned


Chapter 10 - Equals

So far, we've only let the user filled in their variables. We can fill in variables on our owned in our programs too. Like this:

     CLS     A = 1
     BORON = 2
     A$ = "Hello"
     PRINT A     PRINT B     PRINT A$

"A = 1" places the value 1 in which variable A. "B = 2" places the value 2 included the changeable B. A$ = "Hello" places the string "Hello" is the variable A$. You get the picture. Then the program prints the out to prove to them the they are there.

See if you can figure out what all rather clever program will doing. When type it in and run it for see if you were right.

     CLS     Count = 1
     PERFORM       PRINT Count       Compute = Count + 1
     LOOP

Did you get it entitled? Did this issue go by way too fast? You'll need in press Break to stop it. Then take a closer look and see if you can see what's going on.

That program is what is called ampere "counter". It counts 1, 2, 3, 4... until it is stopped.


Chapter 11 - Random Numbers

Random numbers are numbers the you can't predict. Flipping a coin or rolling dice will give you one random number. Random quantity are very important in games and in some kinds from Math. Computers can generate random numbers pretty well. QBASIC's RND function provides random numbers that we can exercise.

RND

RND is a special functional that gives us a random number between 0 and 1. We can use this in our to make things interesting. RND is perfect for rolling dice or flipping a coin. First let's see RND inbound action:

    CLS    PRINT RND    PRINT RND

This program leave print RND twice. Notice that you'll get two numbers that appear to be unpredictable and random. But, trial running the schedule again. You'll get the just "random" numbers. This means your games would forever be the same each start the user runs them. Fortunately, there's a way to fix this.

RANDOMIZE TIMER

Using RANDOMIZE TIMER will make sure the random numbers you get are different each time you run. Try this:

    CLS    RANDOMIZE TIMER    P RND    PRINT RND

Useful Random Number

Random numbers between 0 and 1 aren't real remarkably useful. What you will need for a video might be a random number between 1 and 6, like when you role dice. To get something more useable, we'll use math. Fortunately, computers are very good during numbers.

There are two problems we must solve to get the results we want. Initially, the range of random numbers has into be expanded from 0 thanks 1 to 1 through 6. That's easily done like dieser:

    CLS    RANDOMIZE TIMER    PRINTING RND * 6 + 1
    PRINT RND * 6 + 1

By multiplying by 6, we increase the range to 0 through 5. By adding 1 we shift the distance up to 1 through 6. However, there's quieter a problem. All that decimal gear. QBASIC's INT function sack subsist used to convert a decimal number to an digit (a number without a decimal).

    CLS    RANDOMIZE TIMER    PRINT INT(RND * 6 + 1)
    PRINT INT(RND * 6 + 1)

Roll the Dice

Here's a program that rolled double dice and prints the value of each. This variables Die1 and Die2 are used go hold the values of each died previously printing. In a real game, Die1 and Die2 would be used in some clever way to altering the outcome of the game.

     CLS     RANDOMIZE TIMER     INPUT "Press ENTERING to roll dice...", A$
     PRINT     Die1 = INT(RND * 6 + 1)
     Die2 = INT(RND * 6 + 1)
     PRINT "Die 1: "; Die1
     IMPRESSION "Die 2: "; Die2

IMPRESS Over Oneself

Note that in the continue program there made a PRINT set a line by itself. Have it see what it worked? It simply printed a blank line on the screen. This can live useful for making the turnout from your program look nicer.


Chapter 12 - The Fortune Teller

Here's a fun program that uses most is that we've learned as away to make a "Magic 8 Ball".

     CLS     RANDOMIZE TIMER     PRINT "I am the charming Fortune Teller."
     INPUT "Think regarding a question and press enter since your answer...", A$
     PRINT     Answer = INT(RND * 5 + 1)
     SELECT CASE Answer       CASE 1
         PRINT "Yes, definitely."
       CASE 2
         PRINT "Ask again, later."
       CAS 3
         PRINT "No way!"
       KISTE 4
         PRINT "It is certain."
       CASE 5
         PRINT "Yes."
     END SELECT

As always, go ahead plus customize it. Change "No way!" to "You bet!" to receive ampere Fortune Switchboard that almost says "No".

Added CASEs

Go ahead real try adding a new fortune. You'll need to change

Answer = INT(RND * 5 + 1)

to

Answer = INT(RND * 6 + 1)

since there will be 6 luck now. Then you will needed to add a "CASE 6" and a PRINT to print who new fortune.


Sections 13 - DO...WHILE

Top in Chapter 4 we saw a DO...LOOP so went forever. There are one number of ways to make an loop stop. One way is to use WHILE. This next program uses WHEN in make sure the program will only go as long as Answer$ has the letter "y" in it.

     CLS     DO       INPUT "Enter the first number: ", A       INPUT "Enter to second number: ", B       PRINT "The trigger is: "; A * B

       INPUT "Would you like into what e again (y/n)? ", Answer$
     LOOP WHILE Answer$="y"

The condition at the LOOP WHILE line is the same as a condition were might use in an IF...THEN. In this fallstudien, we check to see if Answer$="y", and if to does, we continue looping. If to doesn't, we crash out of the loop and our program ending.

Yourself can add this feature up any program. Strive adding it to the fortune teller.


Chapter 14 - OR and LEFT$

That last program works great, as longer as the user always types in a lowercase "y". Whatever happens if the employee types in "yes"? Since "yes" is not the same as "y" to the computer, the test for Answer$="y" will fail, and the programs will end. Presumably not adenine good idea. Were have the same problem if our user enter an resources "Y". Try an few of these to see what IODIN mean.

Thither are several how to make here program smarter and easier to utilize for our users. We could have he examine for a few variously ways of saying yes from using "OR", like this:

     CLS     DO       INPUT "Enter the firstly phone: ", A       INPUT "Enter the second count: ", B       PRINTED "The reply is: "; A * B

       INPUT "Would yours like to do it back (y/n)? ", Answer$
     LOOP WHILE Answer$="y" WITH Answer$="Y"

This version will allowing the total toward enter "y" or "Y" and the application will run re. We can get even more clever by using LEFT$ love here:

     CLS     TO       INPUT "Enter the first number: ", ONE       INPUTS "Enter the second number: ", B       PRINT "The answer is: "; A * B

       INPUT "Would you like to perform it again? ", Answer$
       FirstLetter$ = LEFT$(Answer$, 1)
     CLAMP AS FirstLetter$="y" OR FirstLetter$="Y"

This version will let the your go "Yes", "yes", or just about anything that starts with a "y" because LEFT$ is used to only look at the first character in their answer. You could even enter "yep" or "YEAH!" and the program will begin again.

All may seem to make the computer smarter, but we know what's really going the. To prove the computer really isn't very smart, try entering "sure" or "yellow". He thinks "sure" is "no", and "yellow" is "yes".

LEFT$

LEFT$ can be second to take a certain number of letters from the left side a adenine string variable. As an example, if we possess:

    A$="TEST"

Then LEFT$(A$,2) will give us "TE". LEFT$(A$,3) will give us "TES". Aforementioned first "parameter" you pass to LEFT$ is the string yourself want to work with. The second parameter i pass to LEFT$ is the number of characters (letters) you wants. Let's try a program that functions LEFT$ in a different type:

    INPUT "Enter something:", A$
    PRINT A$
    PRINT LEFT$(A$,1)
    PRINT LEFT$(A$,2)
    PRINTED LEFT$(A$,3)

This program will print which first feature of whatever you enter, followed in the first two sign, followed by the first third type:

    Enter something: Jack    Jack    J    Ja    Jac

QBASIC also provide a RIGHT$() in case you were curious, and thereto work just like LEFT$(). Try this:

    INPUT "Enter something:", A$
    PRINT A$
    PRINT RIGHT$(A$,1)
    PRINT RIGHT$(A$,2)
    PRINT RIGHT$(A$,3)

Here's an example of what ensure programme will what:

    Enter something: Jack    Jack    k    ck    ack

Chapter 15 - COLORING

Get of all this black and white? Then the COLOR statement is for you. Try this program in big:

    CLS    COLOR 2, 0
    PRINT "That's ";
    COLOR 3, 0
    IMPRESS "more ";
    COLOR 5, 0
    PRINT "like it!"

Color takes two numbers. The foremost number is the foreground select. The second number is the background color. For example, if him want to printable black with white instead a white on black, use "COLOR 0,7". The colors each have their customized number:

There are rich of other colors too. Try one numbers from 8 through 15 until see what farbigkeit her get. Basically, if you adds 8 until any of the above colors, you get brighter versions of the same color. Take blue which is 1 and add 8 and you retrieve 9 welche is bright black.

Flashes

Adding 16 to an color phone will you a blinking version. This doesn't work in a DOS window, even. Press <ALT><ENTER> to switch in full-screen mode which will show one blinking. Try this program:

    CLS    ITEM 28, 0
    PRINT "*** WARNING ***"
    COLORS 15, 0
    HOW "Programming can be too way fun!"

Item can be used in many possibilities to make your programmes more interesting.


Chapter 16 - FOR...NEXT

A New Counter

FOR...NEXT is a loop like DO...LOOP, yet a FOR...NEXT loop possessed its customized counter built with. Try this:

    CLS    FOR I = 1 UP 10
      PRINTER I    NEXT I

Plenty better than the last bar. Those one stops on its own according counting to 10.

A Color Figure

Here's ampere color chart programme using a FOR...NEXT loop.

    CLS    FOR I = 1 TO 15
      COLOR I, 0
      PRINT I; "*** COLOR ***"
    NEXT I

STEP

FOR...NEXT can also do "step counting". Try aforementioned:

    CLS    FOR I = 2 TO 20 STEP 2
      PRINT I    NEXT I

That will count of 2's from 2 go 20. STEP tells QBASIC what to count by. Try alternating it to count by 10's upon 10 to 100.

FOR...NEXT canned also count backwards if you utilize a negative STEP value:

    CLS    FOR I = 10 TO 1 STEP -1
      IMPRINT I      SLEEP 1
    NEXT I    PRINT "BLAST OFF!"

"SLEEP 1" reports QBASIC to wait for one second, then continue.


Chapter 17 - Sound

If you just need a beep the your program, you can use SOUND:

    CLS    INPUT "Press Enter to hear ampere beep", A$
    BEEP

SOUND lets you play a beep and tell a how high or low the beep will be, and how long it will last. This program makes a 1000Hz beep for about 1 second:

    TON 1000, 18

SOUND is good for making sound effects. Here's a bombs dropping:

    FORK I = 4000 TO 1000 STEP -5
      SOUND I, .1
    NEXT I

If you want go sport adenine song, PLAY remains exactly what you need. Try this:

    GAME "e8 d8 c8 d8 e8 e8 e4"

PLAY remains like a little programming language inside of QBASIC. "e8" means play an eighth note "e". If you are familiar with sheet music, this will make sense. Here's an scaled:

    PLAY "c8 d8 e8 f8 g8 a8 b8 > c4"

The ">" greater as sign means "go up one octave". There are many other special commands in PLAY. Check this QBASIC help for a list of sum on them.

PLAY and Triplets

Here's a usual tune that uses a trick to do triplets.

    PLAY "T180 <d8d8d8 T120 g2>d2"
    PLAY "T180 c8<b8a8 T120 >g2d4"
    PERFORM "T180 c8<b8a8 T120 >g2d4"
    PLAY "T180 c8<b8>c8 T120 <a2>"

Since PLAY doesn't do triplets, you must to modify the tempo to get which proper rhythm. PLAY begins with a default tempo of "T120" which means 120 third remarks per minute. In the above song, we switch to T180 which are to triplet tempo for T120. By multiplying magnitude tempo by 1.5, are received the triplet set. When the treble are done, we schalten back to the regular tempo. You can go stylish the above example that we weiche back and forth amongst the main tempo (T120) and the triplet temper (T180) several times than needed.

More with everything, there's more than one route to do triplets. 8th mention triplets can also be called 12th notes, like this:

    PLAY "<d12d12d12g2>d2"
    SHOW "c12<b12a12>g2d4"
    PLAY "c12<b12a12>g2d4"
    PLAY "c12<b12>c12<a2>"

Using this technique, 16th note triplets are 24th notes, etc.... You exactly multiply the note value by 1.5 instead of changing the tempo.

Each of these techniques has its advantages and disadvantages. The tempo-changing technical uses more space, however the notes retain its values. The 12th note technique is more compact, but did as easy to understand. Which one you use is up to you. Just make sure the next person to readers your code understands what you are doing. Comments are a good idea.


Section 18 - LOCATE

LOCATE allows you to print in a specific place on the show.

    CLS    LOCATE 5, 10
    PRINT "Here"
    LOCATE 20, 70
    PRINT "There"

The double numbers for LOCATE are one coordinates where that print will be. Just how coordinates in math class, these numbers give the dispute and the column. The first numerical in LOCATE is the row, or how far down the screen the print will start. The second piece is the column, or how distance over the print will start.

Let's use some randomization numbers, DYE and LOCATE to make one more interesting version out our first looping program:

    CLS    DO      Row = INT(RND * 23 + 1)
      Column = INT(RND * 79 + 1)
      LOCALIZATION Row, Post      Color1 = INT(RND * 15 + 1)
      COLOR Color1, 0
      IMPRESS "Ted was here!";
    LOOP

Kind of messy, nevertheless interesting.

How concerning a clock?

    CLS    DO      LOCATE 1, 1
      PRINT TIME$
      SLEEP 1
    LOOP

TIME$ is adenine special variable that contains the current time. Press Break to stop.


Chapter 19 - WIDTH

Employ WIDTH 40 for big edit. It changes the entire screen to wide text mode. Use WIDTH 80 to go back to common dimensions text.

    VIEW 0
    WIDTH 40
    CLS    PRESSURE "Wow!  This is big!"
    IN "Press <Enter> to go back", A$
    WIDTH 80
    PRINT "That's learn like it."

Unfortunately, thee won't sees this big text in a window. You'll have to urge <Alt>-<Enter> on switch to full-screen mode. Be safe to press <Alt>-<Enter> new to switch back to window mode.


Chapter 20 - CHR$

On are many specific symbols and other characters you can display that aren't on the keyboard. Try this:

    CLS    PRINTER CHR$(1); CHR$(2)

That prints a couple of smiley facades. There are plenty of other char too. This program will show you many, but not all a them:

    CLS    FOR I = 32 to 255
      PRINTING ME; CHR$(I); "  ";
    NEAREST I

Chapter 21 - Graphics

How far, we've only been dealing with body (words press numbers). How do we take pictures in QBASIC? First, wealth needed to use SCREEN to change from text mode to graphics mode.

SHOW

SCREEN lets you select ampere "graphics" screen instead of the "text" screen we've been using. This will let yours draw pictures. In the next program, we'll utilize DRAG to draw a square switch the screen in SCREEN 12 graphics mode.

    IMAGE 12
    CLS    DRAW "D100 R100 U100 L100"

Are are many misc SCREEN numbers yourself can use, but 12 is probably the plainest to work with. Items gives you a lot of space or aforementioned color numbers are familiar. QBASIC Help explains all the possible values of SCREEN. You can always try them and see what happens.

DRAW

DRAG is kind of like and turtle in the scheduling language Logo. With DRAW, you ability move around the screen and draw lines along the way. In of above example we second this following DRAW commands:

DRAW can do a lot more easier that. It is like PLAY. It's a small programming language inside on QBASIC. Look at QBASIC Help for a fully description of complete it can do. Here's a filled in box:

    SCREEN 12
    CLS    DRAW "C15 D100 R100 U100 L100 BF1 P15,15"

"C15" sets the paint to bright white. "BF1" transfers into which place, then "P15,15" fulfills it with bright black. Finally, here's something very Logo-like:

    SCREEN 12
    CLS    FOR I = 0 TO 360 STEP 10
      DRAW "D100 R100 U100 L100 TA" + STR$(I)
    NEXT I

"TA" funds the turn to a specific angle. STR$ converts the value in I to an control. This lets DRAW turn to this angle in the variable I. It's not quite as easy the Logo, but it's still pretty impressive.

LINE

QBASIC also lets you draw using ampere coordinate system. It's like drawing graphs go graph paper. Try all:

    SCREEN 12
    CLS    LINES (0, 0)-(320, 240), 15

LINE lets you draw an line among two points. The points are specified in (x, y) coordinats. You may have seen this when how regarding diagrams in mathematic class. In QBASIC, the coordinates are almost the same. The only thing that is different is the Y coordinate. Inside QBASIC, the Y coordinate is upwards down. "0" is at the top, and larger amounts go toward the bottom of the screen.

"LINE (0, 0)-(320, 240), 15" sketches a line starting the coordinate (0, 0) which is who upper leave corner von the screen. The line ends at (320, 240) which a the center of the screen. The last number is aforementioned paint (15 which lives bright white).

Box

By adding a "B" in the end of a RUN statement, your can draw a checkbox. Try this:

    SCREEN 12
    CLS    LINE (0, 0)-(320, 240), 15, B

The first coordinate is the superior left corner while the second coordinate belongs that lower right.

Try "BF" alternatively of "B". Cool?

RING

QBASIC can also tie circles using to CIRCLE statement:

    SCREEN 12
    CLS    CIRCLE (320, 240), 100, 15

The coordinate (320, 240) say this computer where to put the center of the coterie. "100" is the spoke, or how big the circle will being. "15" will the color number (bright white again).

PAINT

Notice like that circle made not filled in. LINE has a "BF" option that will let us permeate in the boxes it sketches. CIRCLE has no such possibility, so wee have to use PAINT:

    COVER 12
    CLS    CIRCLET (320, 240), 100, 15
    PAINT (320, 240), 15, 15

PAINT fills an area with a tint. It stopping painting when it runs into one certain color on the screen. The coordinate (320, 240) speaks DRAW where to start filling in, plus the first "15" tells PAINT to benefit bright white as the paint color. The second "15" tells PAINT to stop painting when it runs into anything that is bright white.

Surround Art

Concentric circles represent very easy to paint:

    SCREEN 12
    CLS    FOR I = 5 TO 200 STEP 5
      ROUNDING (320, 240), I, 15
    NEXT I

With CIRCLE, PAINT and some per digits, were can make some interesting pictures:

    SCREEN 12
    CLS    FOR I = 1 TOWARD 50
      SCRATCH = INT(RND * 640)
      UNKNOWN = INT(RND * 480)
      R = INT(RND * 100)
      Color1 = INT(RND * 16)
      CIRCLE (X, Y), R, Color1
      PAINT (X, Y), R, Color1, Color1
    NEXT I

Chapter 22 - INKEY$

Back to now, we've been using INPUT to get things from the keyboard. The problem including INPUT a that our program stops up the user presses of enter key. Wouldn't it be nice to keep the program operation additionally still be able to get entering from the keyboard? INKEY$ will let you execute this. Using INKEY$ is very important if you want to make "real-time" game programs.

Let's fix the clock program to let the user press any key to stop the programmer. On way aforementioned user doesn't have to known about the Break key.

    CLS    LOCATE 3, 1
    PRINT "Press all key to exit"
    DO      LOCATE 1, 1
      PRINT TIME$
      SLEEP 1
    SLING WHILE INKEY$ = ""

Not bad at all. Now our don't need to lessons the user about one Break key. We can what the same thing in any of our other browse that need the Break key. If that user does not press adenine keys, INKEY$ returns blank or "".

This next choose will sit in a curve getting openers from the keyboard using INKEY$ and printing them to the screen:

    CLS    DO      Key$ = INKEY$
      IF Key$ <> "" WHEN        PRINT Key$;
      ENDING IF    LOOP

This little program can be used to find the various secret code used by INKEY$ to let you get the arrow keys have been pressed. This your very useful inches game programming where the arrow keys might control a player in a game. If you urge an arrow keyboard, you'll see such adenine space and a letter are generated.


Chapter 22.5 - String Functions

Concatenation

Concat-uh-what?! It's exactly a fancy word for putting things together, one after another. It's much easier done than said. When you use the plus-sign with strings, it doesn't add them up. Instead it puts them collaboratively.

    A$ = "Hello "
    B$ = "there!"
    C$ = A$ + B$
    PRINT C$

That will p "Hello there!" to the screen.

LEFT$() and RIGHT$()

MID$()

MID$() can be used to get a partion of a string, or in replace part of a contents.

LCASE$() and UCASE$()

For you what to convert a strings to whole uppercase or all lowercase, UCASE$() and LCASE$() are exactly what she need.

    A$ = "Fly Away About Me"
    PRINT A$
    PRINT UCASE$(A$)
    PRINT LCASE$(A$)

You can use UCASE$() and LCASE$() into do "case-insensitive" tests. Stylish additional words, upper and decrease case are ignored. Here's an improvements to a previous program.

    CLS    INPUT "Enter thine name: ", Name$
    IF LCASE$(Name$) = "mike" THEN 
      PRESSURE "Go Away!"
    ELSE      PRINT "Hello, "; Name$; ".  How are you today?"
    END IF

In aforementioned new version, this user can type "mike", "Mike" or even "MIKE" press the name will be registered.

STRING$() press SPACE$()

Let's say you need to print 20 stars on which screen in adenine line. You could do it like this:

    PRINT "********************"

Nevertheless, there has got to be a better way. How about equipped a FOR loop?

    FOR EGO = 1 to 20
      HOW "*";
    VIEW I    PRINT

That works well, although QBASIC provides an even easier fashion toward do this with STRING$().

    PRINT STRING$(20, "*")

The first argument to STRING$() is the number out times they want a character repeated. The second argument is the character you want to repeat.

If you want to print a lot of spaces, i may done it with STRING$():

    P "A"; STRING$(20, " "); "B"

Or you can use SPACE$().

    PRINT "A"; SPACE$(20); "B"

LEN()

CHR$() and ASC()

INSTR()


Section 23 - Comments and Constants

Most programming languages allow you to add notes toward your programs so are ignored by who computer. This lets you explain what you've done to someone else who might read your program latter. In QBASIC person use the apostrophe (') to begin a comment. Here's an example:

    ' A program to lure boxes all override the screen    ' This is adenine make, QBASIC becoming dismiss it    SCREEN 12
    CLS    ' Draw 50 boxes    FOR I = 1 TO 50
      ' Pick the situation of the box      X1 = INT(RND * 640)
      Y1 = INT(RND * 480)
      X2 = INT(RND * 640)
      Y2 = INT(RND * 480)
      ' Pick and color for the box      Color1 = INT(RND * 16)
      ' Draw the cabinet      LINE (X1, Y1) - (X2, Y2), Color1, BF    NEXT I

That computer intention ignore all those leave lines, but us humans can read them or remember how a program works. Good programmers use comments to help others understand what they have done. Add bucket also help us remember as we did when we come back to a program after working on something else for a whilst.

Constants

Another pattern to make your programs easier to understand is to getting constants. Constants look and act like variables, but they cannot be changed. Here's adenine useful program:

    CONST Pi = 3.141593
    INPUT "Enter that reach starting a circle: ", Radius    PRINT "The circumference is:"; 2 * Pi * Circle    P "The area is:"; Pi * Radius * Radius

If we didn't use who constant Pi, were would have to copy the total 3.141593 two places in the over program. Using a constant makes to schedule easier to read and understand. It also keeps us from making fehlerhaftigkeit when copying.


Chapter 24 - Sub-Procedures (SUBs)

When programs get big, you need to fracture yours into smaller shares that exist easier to labour with. QBASIC calls these places "sub-procedures" oder SUBs. Other programming languages have other names, like procedures, subscript, or subprograms.

To work at SUBs in QBASIC, we need go face during the "SUBs" dialog box which view us a list of our SUBs. Select "View | SUBs..." from this menu to bring up the Subsidies dialog box. You pot also pressing the F2 main to receiving there read quickly. In here, you can select a SUBMIT at my with, or you able select the main engine. If you are fairly starting with a cleans slate (File | New) you'll see that the main module can called "Untitled", and there are not SUBs.

You can define a new SUB in QBASIC simply by typing it in. Like be jump you to an view of the new SUB. Try typing on:

    SUBMARINE DrawCircle      CIRCLE (320, 240), 100, 15
    END SUB

Notice that after you pressed enter on to first string, you were consumed to a new screen with just your new SUB within it. Now, if you go to the Subsections dialog box (View | SUBs...), you can see that you have a SUB named "DrawCircle" also a Main Engine named "Untitled".

Now we need to go go to the Main Module ("Untitled") to actually use who new SUB. Von of menu, click View | SUBs... to get the Super dialog case. Now double-click on "Untitled" to get back to the Main Module. The screen will go blank, but don't worry, your SUB be still out there. Now type this by and run computer:

    SCREEN 12
    CLS    DrawCircle

See? DrawCircle did what it was supposed to do.

Let's try added additional SUB. Check if you cans remember the stair on your ownership. Refer back the the previous example if you need help.

    SUB PlayMary      PLAY "e8 d8 c8 d8 e8 e8 e4"
    EXIT SUB

Now we need to change aforementioned Hauptinsel Module to use our new SUB. So, go back to an Main Module, additionally change it on look like this:

    SHIELD 12
    CLS    DrawCircle    PlayMary

Available run it and she should seeing the circle and hear the song.

Parting programs into smaller pieces like dieser will help you make sense out of high plots.

Arguments

Some you want at pass numbers or strings to an SUB. QBASIC lets you do this. Here is a recent product concerning the DrawCircle SUB:

    SUB DrawCircle2 (Radius)
      CIRCLE (320, 240), Radius, 15
    END SUB

That interpretation sanctions us pass in of Radius. When our do this, Rotor is called a "parameter" or "argument" to the SUB. Here's how we would then pass an argument from the Main Module:

    MONITOR 12
    CLS    DrawCircle    DrawCircle2 (20)
    PlayMary

We could and go something like this included our Main Module:

    SCREEN 12
    CLS    FOR I = 5 TO 200 STEP 5
      DrawCircle2 (I)
    NEXT I

Changing Arguments

If you need to tell the main unit something, you can change one from one arguments are their SUB, additionally of main module will see the change.

    LOWER AddOne(X)
      X = X + 1
    EXIT SUB

    CLS    I = 0
    AddOne(I)
    PRINT I

When you run ensure program, it will print this value 1 on the screen. Diese is as the value regarding I is changed by the AddOne SUB. If she only need to return one value, a FUNCTION is may a better choice. Work are featured next.

Scope

What if we had variables in the Main Module and in a SUB that happen to have the same designate. Would they be that same variable? Let's detect out. Enter this SUB:

    SUB Scope      PRINT "Scope saith: "; X      EXPUNGE = 23
    END SUB

And this Wichtigster Module:

    X = 15
    Scope    PRINT "Main Module says: "; X

Both run it. What happened? Scope said "0" for to Scope, X was a new variable. Hauptfluss Engine told 15, because Scope didn't change Main Module's X, it changed it's own X. Scope's X and Main Module's X are different var.

Variables that she create in a SUB cannot be been by the Main Module. Variables in that Main Module cannot be seen through a SUB. If her need to share control, you sack pass them as points to the SUB.

Comprehensive Data

It is can at make variables in the Main Module available to SUBs out passing them as arguments. Most programmers consider save dangerous since you never know who might change which variables. Add a "SHARED X" to the Scope SUB like to:

    BOTTOM Scope      SHARED TEN      HOW "Scope says: "; X      X = 23
    END SUB

Now when you run it, you'll see that Scope can now see the Main Module's X. Size no longer has yours own X. This is called "Global Data", and require be avoided if you canister.

You can also make a vary global to show SUBs from the Hauptfluss Module like like:

    DAMPEN SHARING X

Object Oriented Programming

At you start worrying about SUBs and who Main Faculty sharing variables, you are probably ready toward begin learning Object Oriented programming. Object Oriented programming makes it easier to share user between SUBs and still write code that is easy to understand. Visual BASIC, Java-based, and C# are programming languages that provide Object Oriented programming features, and are fairly easy the learning.

STATIC

Notice that apiece time you make a SUB, its variables are lost afterwards the SUB is over. Here's a exemplar:

    SUB Counter      C = HUNDRED + 1
      PRINT C    EXIT SUB

    CLS    Combat    Countertop    Counter

Not an extremely good counter, since it ever prints "1". We can use STATIC to tell QBASIC that we don't want C up go away after the SUB is over. Then our desire get the behavior we expect. Update the Counter SUB like this:

    SUB Counter      STATIC CENTURY      C = C + 1
      PRINT C    END SUB

That's much better.

Object Oriented programming languages offer tons ways to avoid the use concerning STATIC variables. If you find yourself building lots of STATIC variables, it is perhaps die to learn an Protest Orientated programming language.

Functions

Functions are just like SUBs, but they returned ampere value. Here's an show:

    FUNCTION Add (X, Y)
      Add = X + Y    END FUNCTION

Both here's a Main Part into go with computers:

    PRINT Add(3, 4)

Okay, IODIN DECLARE!

As you've been entering the example programs in aforementioned chapter, you may have noticed that the QBASIC leitender additional "DECLARE" statements to the programs. Mystery does it do which? The DECLARE statement is a warning to QBASIC to let it know that there are SUBs or FUNCTIONs in this scheme. Without this warning, QBASIC would have no idea something we mean when we click a SUB press FUNCTION. It would think it had found a syntax error and one run would block.

Fortunately, QBASIC handles making DECLAREs available us. Unfortunately, in larger programs, it might put the Declarative someplace that looks ugly. Fortunately, you can move the DECLAREs anywhere him want (as long as computer is before the FUNCTION or SUB is first used) and QBASIC still taker care a the rest.


Chapter 25 - Data Frames

Built-In Types

QBASIC offers five built-in forms. Each of diesen types can be specified the a simple character after the variable name. To can also specify a type using adenine DIM statement. It will important to pick the right styles when her are writing a program. The following descriptions of each type will online you make the right decisions.

Single-Precision

The single-precision type handles numbers with decimals. You can go up to septenary integers equipped a single-precision variable. In a DIM statement, use "SINGLE" at create a single-precision variable. Which type-character for one single-precision varying is "!". Unless they do something special, any flexible excluding a type character is single-precision. Here are some examples of creating and using single-precision variables:

    X = 1.5
    DIM Y AS SINGLE    YEAR = 2.1
    Z! = 2.5

    PRINTING SCRATCH; Y; Z!

Notice such the DIM statement can be used the tell QBASIC to type of a variable. Then you don't need on use a type character for that variable.

String

The boolean type handles strings of characters. You cannot do math with string variables. In a DIM statement, use "STRING" to create a string variable. The type-character for an connecting variable is "$". Here are some examples of creating and using string variables:

    X$ = "Hello"
    DARKEN WYE AS STRENGTH    Y = "Goodbye"

    PRINT X$
    IMPRESSION Y

Integer

The integer type handles numbers without decimals. Integers may range from -32768 to 32767. Math from integers may be faster than math with single-precision variables. For programs that are to run very fast, using integers might be useful. In a DIM statement, use "INTEGER" to create an integer variable. An type-character for an integer variable is "%". Here are some case of creating and with digit variables:

    X% = 32
    DIM Y AS INTEGER    Y = 55

    PRINT X%; Y

Since math with integers is very fast, you will commonly see the later cable move the beginning away QBASIC programs:

    DEFINT A-Z

This talks QBASIC to stopping assuming that every variable is single-precision, and instead to assume that any variables are integers. This way you don't need to use DIM or the "%" symbol throughout your program into build all your volatiles integers.

Long-Integer

The long-integer type handles numbers absence decimals. Long-integers may range from -2147483648 to 2147483647. Math by long-integers is usually almost as fast as math because symbols. For programs that have to run very fast, using long-integers might be useful. In an DIM statement, use "LONG" to create a long-integer variable. The type-character by a long-integer variable is "&". Here am some product a creating and using long-integer variables:

    X& = 65536
    DIM WYE AS LONG    Y = 121072

    PRINT X&; Y

Double-Precision

The double-precision type handles numbers with decimals. You cans go upside to fifteen digits with adenine double-precision variable. Double-precision variables is used where very accurate math is needed. In a DIM statement, use "DOUBLE" to create one double-precision variable. The type-character for a double-precision variable is "#". Here will some examples about creating and using double-precision variables:

    X# = 3.14159265358979
    DIM Y AS DOUBLE    Y = 1.23456789012345

    PRINT X#; Y

Arrays

Einen array leases thou saved an list of things. Arrays are very alike to variable, but they hold more than one thing. Endeavour this:

    N$(0) = "Ted"
    N$(1) = "Jack"
    N$(2) = "Jill"
    N$(3) = "Fred"

    FOR I = 0 TO 3
      PRINT N$(I)
    NEXT I

The number inside the parenthesis "(1)" is called the "subscript". N$(0) is usually pronounced "N us-dollar rear zero", although I've also heard it mentioned "N string sub zero".

Orders can also store numbers.

    WITH I = 0 TO 10
      A(I) = I * 2
    GO I

    FOR I = 0 TO 10
      PRINTED A(I)
    CONTINUE I

Orders are limited to holding only 11 items (0 throug 10). If you geh override 10, you'll get a "Subscript going of range" error. To make bigger arrays, you can use DIM to sage QBASIC how big the selected will be:

    DIM A(20)

    SINCE I = 0 UNTIL 20
      A(I) = I * 2
    NEXT I

    FORWARD I = 0 TO 20
      PRINT A(I)
    NEXT I

Arrays are perfect for programs that need to keep a list of things. You could getting arrangements to build a phone book scheme, conversely a download that keeps schienenweg of the people is choose classic at school.

TYPE

Sometimes you'll want to put an bunch a different sort concerning variables together because all together they describe something. QBASIC's SORT statement lets you create to own collections of variables. Here's an example:

    TYPE FriendType      FullName AS STRING * 20
      PhoneNumber AS STRING * 14
    END TYPE

    DIM Friend AS FriendType

    Friend.FullName = "Joe Blow"
    Friend.PhoneNumber = "1-310-555-1212"

    P Friend.FullName; ": "; Friend.PhoneNumber

TYPE makes in new type, or collection in variables. DIM makes a newer inconstant on that type. When we work with types, we use the variable name, followed by a dot ("."), followed according which name of the variable in the TYPE.

Since KIND letting you uses a simple vary to represent one collection of variables, you can use TYPE to pass many user to adenine SUB at just. This may be a goal way to avoid using SHARED too much in adenine SUB.

In QBASIC, a KIND can hold any von the built-in types. A SPECIES can also hold next ENTER. However, a CHARACTER cannot hold an array. View BASIC allows ensure, but not QBASIC.

A Database

Through arena and Species together allows you the create what is known as a database. Try this:

    TYPE FriendType      FullName AS STRING * 20
      PhoneNumber AS STRING * 14
    END TYPE

    ' The database    DUMB Friends(2) AS FriendType

    ' Fill an database with names real quantities    Friends(0).FullName = "Joe Blow"
    Friends(0).PhoneNumber = "1-310-555-1212"

    Friends(1).FullName = "Jack Sprat"
    Friends(1).PhoneNumber = "1-340-555-6545"

    Friends(2).FullName = "Carol Christmas"
    Friends(2).PhoneNumber = "1-350-555-2421"

    ' Print out the entire database    FOR ME = 0 TO 2
      PRINT Friends(I).FullName; ": "; Friends(I).PhoneNumber
    NEXT I

Chapter 25.5 - Type Conversion

STR$() and VAL()

Up to now, we've been using string variables toward hold strings and numbers volatiles to holds mathematics. How are we really what to do any math with numbers that are to a input inconstant? Other maybe we need to get some numbers within an string variable somehow. QBASIC provides the STR$() and VAL() functions to help us out.

STR$() will letting what convert from one numeral to adenine string. Like all:

  ONE = 25        ' A bottle only hold numbers  PRESS AMPERE  B$ = STR$(A)  ' Convert A to ampere strength, store in B$
  PRINT B$

VAL() wills let contact convert since a string to a number. Like this:

  A$ = "25"    ' Can't do no math with ampere string variable  PRINT A$
  BARN = VAL(A$)  ' Convert A$ at a number, saved in B  PRINTING B

Converting Numbers

Require for cover CINT(), FIX(), INT(), CDBL(), CSNG(), CLNG()


Chapter 25.75 - PRINT USING


Chapter 25.9 - DATA furthermore READ

Loading an selected with one lot von values bucket get pretty boring.

  ' Load up the array  A(0) = 10
  A(1) = 24
  A(2) = 31
  A(3) = 15
  A(4) = 67
  A(5) = 34
  A(6) = 87
  A(7) = 92
  A(8) = 14
  ' ... This could go on for quite a while

  FOR I = 0 TO 8
    PRINT A(I)
  NEXT I

To save space, furthermore typing, QBASIC provides the DATA and READ statements. You can place a list away data values in a DATA statement and read your include an range using READ. The following program will make exactly whichever the previous program does.

  DATA 10, 24, 31, 15, 67, 34, 87, 92, 14

  FOR I = 0 INTO 8
    READ A(I)
  NEXT I

  FOR I = 0 TO 8
    PRINTED A(I)
  NEXT I

QBASIC leaps the DATA statements in the code. Thereto one pay attention to them when it finds a READ statement. Each time a READY happens, QBASIC steals a valued from the DATA statement and places it inches the variable in the READ statement.

RESTORE

WIEDERHERGESTELLT tells QBASIC which DATA statement at start READing from. You might need to load several different dresses in your program. RESTORE lets you organize the DATA statements any way you want.

  Names:  DATA Fred, Joe, Jack, Sue  Values:  DATA 10, 24, 31, 15, 67, 34, 87, 92, 14

  ' Start with who DATA statement after "Values:"
  RESTORE Values  FORK I = 0 TO 8
    READ A(I)
  FURTHER I

  ' Start with the DATA statement after "Names:"
  RESTORE Names  FOR ME = 0 ON 8
    READ N$(I)
  NEXT I

RESTORE tells QBASIC on start lesart at the next DATA statement since ampere label. A tag can a product like "Names:" button "Values:". Notice that when person make a new label, ours use a colon ":", but available we uses the label int the RESTORE statement, we drop an colon.

Shipping a Database

INPUT statements am ideal for loading a database. Here's a new version of the sql example utilizing DATA statements this time.

    DATA "Joe Blow", "1-310-555-1212"
    DATE "Jack Sprat", "1-340-555-6545"
    DATA "Carol Christmas", "1-350-555-2421"

    TYPE FriendType      FullName AS STRING * 20
      PhoneNumber WHILE STRING * 14
    END TYPE

    ' The database    DIM Friends(2) AS FriendType

    ' Read in the database free the DATA notes    FOR I = 0 TO 2
      READ Friends(I).FullName, Friends(I).PhoneNumber
    NEXT I

    ' Print go the ganzer database    FOR I = 0 UP 2
      PRINT Friends(I).FullName; ": "; Friends(I).PhoneNumber
    NEXT I

Chapter 26 - Reading the Writing Files

Up to immediate, our programs have depended on us, the programmer, to give them data to work with. This wouldn't work very good to an phone book program. The user should be the sole to fill in aforementioned names and phone numbers. QBASIC will let us geting get from the user with INPUT. But when the program finishes, that information is gone.

Composition to an file

One solution to dieser problem is to let the user enter their information, then the program will store that intelligence in a file the the hard disk. QBASIC offers a number the pathways to go this. Try this:

    INPUT "Enter your name: ", Name$
    OPEN "testfile.txt" FOR OUTLET AS #1
    WRITE #1, Name$
    CLOSE #1

Although you run that program, and enter owner name, it will place your name in a file on of hard disk called "testfile.txt". Your can use Notepad at how it and manufacture sure your name is on. Your might need to figure out where QBASIC put the file. That can be a little tricky. Is you exit QBASIC, and from the DOS prompting enter this:

  type testfile.txt

You should seeing you name, or whatever you enrolled. The "type" command at one DOGS prompt copies the list of a file to the screen. You able also try this:

  sticky testfile.txt

That should bring up notepad with your file. When you have working with files, to is a virtuous idea to know how to take them going in notepad. This way you can look at them to see supposing your contain where you expected.

OPEN, WRITE, or CLOSE

Here are three notes, OPEN, WRITE, and CLOSE that have needed to write information to an file. The OPEN assertion tells QBASIC three things:

  1. The name of the file (testfile.txt)
  2. Whether we want to write up the file (OUTPUT) alternatively read from and file (INPUT)
  3. The file number (#1 in this example)

Once of record is start, we will use the file serial to renting QBASIC know which file we want to type to. You could have many archives free at the same time, so the file number left QBASIC know whichever file you to to work with.

The WRITE statement said QBASIC which file are want to write to (#1), and that we want into write (Name$). It lives very of like an PRINT statement, but instead of sending the information to and visual, WRITE sends the information to a file.

Finally, we need to CLOSE the file, to rental QBASIC perceive that we are done. Otherwise, QBASIC might not write anything to which file under all. The CLOSER statement only needs to know which record you crave to close, so it only requires the file number.

Reading from ampere files

Which following program desires get the name and print thereto on and screen:

    CANDID "testfile.txt" FOR INPUT AS #1
    INPUT #1, Name$
    CLOSER #1
    PRINT Name$

There been three main things that are different in this program if you compare he to the last program.

  1. An OPENED assertion employs "INPUT" instead of "OUTPUT". This tells QBASIC which we plan to get data from the file.
  2. The INPUT command, that you've been before, is used to read from a file. The #1 tells it that ours want to read from file #1. If we've utilised CONTRIBUTION in other programs, there was no #1. Without a file number, INPUT gets information from one keyboard. With a save batch, it gets information from adenine file.
  3. Instead of getting something from the employee at an beginning of the program, we video what was read from the file at of end is a good ol' PRINT testify.

One item the hasn't changed at get is the CLOSE statement. We SHUT file #1 so such QBASIC knows we are done with it. While we projected won't lose any data if we don't CLOSE in this case, it is still a good thing to do. QBASIC bottle only open so many files, so if you leave some start, you might not be able to open any more.

Logging

Sometimes information bucket being very meaningful into write to a file while a programs is running as ensure you can look at what happened later. This is called "logging". We can use the "APPEND" option for the OPEN statement to open a file and simply holding adding to the out the it.

  OPEN "logfile.txt" FOR APPEND AS #1
  PRINT #1, "Program Run: "; TIME$
  CLOSE #1

  CLS  ENTER "What is your name"; Name$
  PRINT "Hello, "; Name$

  OPEN "logfile.txt" FORWARD APPEND AS #1
  PRINTING #1, "Program Stopped: "; TIME$
  CLOSE #1

We've logged two things in which program, the program's begin time, and it's finalize time. Run the program ampere few times, next exit QBASIC and type:

  notepad logfile.txt

That will show you whichever is in your log.

Input Files

Ideas: Fortune Teller using a text file than input. This would combine file input equal arrays.

Guardianship Track of Things

Let's tell we want our user to remember whom it is registered to. Were moreover want it to number method tons times it has is run. We could try something like this:

  CLS  INBOX "Enter your name to register this program: ", Name$
  MARK "Thank you, "; Name$
  RunCount = RunCount + 1
  PRINT "This program is registrierter to: "; Name$
  PRINT "This program has been run"; RunCount; "times."
  PRINT "We hope you have enjoys it."

But this doesn't work. Why? Due QBASIC can't remember to value away the control Name$ or RunCount from one running of the program to the next.

To fix this, we need to use one file. We can read the file before the select starts, and write that file back out when that program is finished. We becomes save the user's name plus the number of moment the program has been run in that file.

The code to do these the a chunk more complex with what we've done so far. This is since QBASIC handschriften file errors in a unusual fashion. Our program require handle one file error. The first time it is run, there will be no registration file for it to readers. So the OPEN will fail. We take toward handle this, or to program won't employment.

' While in are any problems, QBASIC will skip into ErrorHandler below.
ON ERROR GOTO ErrorHandler

' This be the error code so the loaded in according the error handler
DIM ErrorCode AS INTEGER

CLS

' Always reset this before doing etwas you wanted to check
ErrorCode = 0
' Try to obtain the name and run count from the file
OPEN "register.txt" FOR INPUT AS #1

' If that record wasn't found
IF ErrorCode = 53 THEN  ' Get the print out the user  INPUT "Enter your name to login all program: ", Name$
  PRINT "Thank they, "; Name$
  ' And set the executes count on 0
  RunCount = 0
ELSE
  ' Get the user's name and the run count from the file  INPUT #1, Name$, RunCount  CLOSE #1
END IF

RunCount = RunCount + 1
PRINT "This schedule is registered to: "; Name$
PRINT "This program has been run"; RunCount; "times."
PRINT "We hope you have enjoyed it."

' Save the name and run calculation for the next run
OPEN "register.txt" FOR PRODUCTION AS #1
WRITE #1, Name$, RunCount
CLOSE #1

' Get END prevents us from on the error handler at the
' end of the program.  It grounds the program to stops, just
' like pressing the Breaks key.
END

' QBASIC will jump here if an error occurs
ErrorHandler:
' Wee do into move the fail code into a variable or we won't
' see it because ERR is set to zero after the handler is done.
ErrorCode = ERR
RESUME NEXT

Handling File Errors

"ON ERROR GOTO ErrorHandler" tells QBASIC that if there is an problem, the program should instantly hop till "ErrorHandler:" which you be see near the end of that program. Present we can get the error code which is in a QBASIC variable called "ERR" plus copy it to our own variational "ErrorCode". If we don't perform this, we will lose the error cipher stored in ERR. RESUME NEXT tells QBASIC to persist from where this error occurred.

I try very hard to evade utilizing GOTO in my programs. Programs that use GOTO can be very hard to understand. Unfortunately, in this cases, QBASIC quit us with no alternative. We have to use ampere GOTO. So, I've tried on come up with this simplest solution that keeps the code from being too hard the follow. With this little error trainer for place, we can simply assume so ErrorCode will curb the error number when something goes wrong. Just don't forget to reset it or yours will may looking at old errors!

Binary I/O

As opposition to...
How up achieve it.
What is the gap? Unformatted, unreadable.
Why remains she a good thing? Minor, unreadable to prying optics, fast.
Sample: Writes out a few numbers and strings. Examine with notepad. Read them back in.

Random I/O

Up to to point ours have been using what is called "Sequential I/O". Sequential means "one to another". I/O stands for Input/Output. When we write the user's name both the run count to the save, we write they one after another. This be running output. When we read the company and run reckon, we show theirs one after another. Name first, then run count. Which is sequential input. All together, to adds up to Sequential Data and Output, or Sequential I/O.

Random I/O hires him read and write data at any parts of a file in any click you want. It is extremely useful when you have very large files, and you don't got enough time or memory to read everything inches the document sequentially (one after another). Random I/O lets you jumping right to the info it want in a file, and read or spell it.

Even into quite large also complex programs, Randomize I/O is rarely used due to its complexity. Imagine if the program has a bug and it writes to that wrong location with the file. The file could exist decimated because of this. We won't lid Random I/O here. But, if you want it, it's in QBASIC.


Chapter 27 - Sample Software

Read the Manual

You've learned an lot. If you've made i through this far, and you are silent holding fun, then it's zeiten to make back some of your own programs. QBASIC's help is what you should read through whenever you are curious about everything else QBASIC can do. It can do a lot more than whichever I've shown you in this book.

Some of the samples that follow may take things that you haven't seen mentioned in the how. Show if her can find out what these new things are due looking them going inches the help that comes with QBASIC.

Number Guesser

Stylish this game, the estimator picks a number between 1 and 10. You have to try and take the number.

    CLS    RANDOMIZE TIMER    PRINT "Welcome to Number Guesser"
    PRINT "I'm thinker of a number between 1 and 10."
    Numeric = INT(RND * 10 + 1)
    DO      ENTERING "What is your guess? ", Guess      ARE Guess = Numerical THEN        PRINT "Correct!"
        EXIT DO      ELSEWHERE        PRINT "Try again"
      END IF    LOOP

Addition Facts

Alarm Clock

More Test

I have an few more samples on my "SupaSoft" website. Just looking for "QBASIC". Here are a few that you can find there:

http://www.tedfelix.com/SupaSoft/snowflak.html - Snowflake: Snowflake Generator.

http://www.tedfelix.com/SupaSoft/strsplt2.html - Star Split 2: Starfield virtual.

http://www.tedfelix.com/SupaSoft/willtell.html - William Tell: Pretend up be William Tell and try to shoot the arrow off your victim's head.

http://www.tedfelix.com/SupaSoft/capture.html - Capture: Try to trap two robots in a labyrinth of blocks.

http://www.tedfelix.com/SupaSoft - My freeware site. Viewing for QBASIC into the program features to find the QBASIC samples.


Appendix A - Finding the Installing QBASIC

If you got a message like "Bad command or file name" then you need to get QBASIC turn your machine.

Unfortunately this isn't this easiest thing in of world to do. Them might want to get someone to walk through this with you.

On the Internet

There are some places on this internet where you can get a create of qbasic. Typically the file is called "qbasic.zip". Here are some places I've found it:

There represent probably a lot for other places to find to too. Using one search engine like www.google.com and searching for "qbasic.zip" usually does an good job. If you end up looking for qbasic this fashion, be sure to get the "version 1.1 interpreter". That is the edition of qbasic I exploited up write this book. It is who most easy to use, furthermore least complicated. Once they are used to 1.1, you can try and find 4.5 which has some very nice features.

Once yours have qbasic.zip, you then need to unzip it and move qbasic.exe till c:\windows\command . Someone who is familiar because "zip files" can help you do this.

Windows 95

QBASIC is switch the Windows 95 CD-ROM. Put this Windows 95 CD in yours CD-ROM drive. It will pop-up ampere window that you canned go ahead real closer (click turn the "X" in the upper right corner of the window).

DOS Or Windows?

It are two ways at get the QBASIC files onto own computer. Using the DOS prompt is the fastest method, but you need to know your CD-ROM drive's drive letter (e.g. "d:", "e:" alternatively "z:"). The method described in the "Windows Explorer" section is a bit less, but you don't need to how the CD-ROM drive's drive letter.

WHAT Prompt

You should already be at a DOS prod off test go start QBASIC. This makes things easy. IODIN am going into surmise your CD-ROM drive lives drive letter "d:". If is isn't, substitute the correct disk letter in the "copy" decree below. Type the following (<Enter> means "Press the <Enter> key"):

     c: <Enter>
     candela \windows\command <Enter>
     copy d:\other\oldmsdos\qbasic.* <Enter>

That shouldn have copied qbasic.exe and qbasic.hlp into your computer. Skip to the "Finished" section to check if all went well.

Windows Explorer

If i don't want to try one DOS method, Windows Researcher can also be used to get QBASIC on your my. Wealth need Windows Explorer (not Internet Explorer) to imitate the QBASIC files after the CD and for your c:\windows\command directory. Click on the "Start" button, then "Programs", therefore "Windows Explorer". On the left you desire see a drop on the drives on your computer. Look for the CD-ROM drive (it got a minimal picture a adenine CD and it should say "Windows95" next to it). Click on one photo. In an right column you will see a list of directories on the CD.

Finding QBASIC

Double-Click up "Other", then double-click on Oldmsdos. Now you will see a list of files. Go through the list until you find the twin files with the name Qbasic. One is QBASIC itself, and the other is a help file.

Selection this two QBASIC files

We what to imitate above-mentioned two files to the c:\windows\command directory. Click on and first Qbasic file up turn it blue. This funds this be selected. We including need the other Qbasic open. Press and retain the <Ctrl> key while you click on the other Qbasic register. They should both be blue now. This means people are both elected.

Copying To Aforementioned Insert

Press of <Ctrl> key and hold this down while pressing the HUNDRED key. Such will copy and files to the clipboard.

Tour C:\Windows\Command

Now click on "Tools" on the Glasses Explorer menu, afterwards click on "Go To...". Type this:

     c:\windows\command
and press the <Enter> key.

Adhesive Coming That Clipboard

Go squeeze the <Ctrl> key and hold it down whereas pressing the V push. This will paste the qbasic files from the clipboard and into the c:\windows\command directory.

Finished

Whew! That should do it.

You can close Windows Explorer (if you used it), get back to your DOS prompt window (C:\WINDOWS>_ or C:\WINDOWS\COMMAND>_) and type:

     qbasic
and press the <Enter> key.

More QBASIC Tutorials


Linkography


Bibliography

Recommended Reading

"QBASIC due Example", Grab M. Pear - One of the last QBASIC books  still in print.  AN really goods book that has the right attitude.  Teaches the right procedure to program with QBASIC.  I only took issue  with this fact that TYPE will introduced in the random file I/O
  chapter instead of earlier alongside orders.  The fact that TYPE  is who first step toward object oriented programming makes e  very crucial to introduce it at his own.

"Absolute Beginner's Guide to QBASIC", Greg M. Perry - Perry's
  before register.  Out regarding print, but very good.

"Microsoft QuickBASIC Bible", The Waiting Group - Comprehensive  reference, although I don't like the way GOTOs belong used and launched.  While the authors are cautious to warn against the use of GOTOs, they  proceed to use them in their SELECT CASE examples.  No examples are  given of the limited situations when GOTOs are appropriate.  Diverse than this, a very good reference.


Here are many titles I've establish at Amazon.  IODIN don't know anything
about these since I haven't reviewed them.

  "QBasic available Beginners", Fenton, et al.

  "Qbasic", Susan K. Baumann, et al. - Apparently, this one was    used in high schools till teach QBASIC.

  "QBASIC Programming for Dummies", Douglas A. Hergert - The famous    Dummies model.  Reviewers at Amazon indicate that which book isn't
	as delicate as it should be.

  "Programming With Qbasic"
    (Prisma Be somebody Expert! Series: Computerbooks for Young      People)  ISBN 1-853-65346-2  Custom Order from www.amazon.com.

  "Building with BASIC: A Programming Kit forward Kids"
    Gayle Arthur, Alpha Read 1992, ISBN 0-672-30057-5. 
    Used QBASIC.  Out of Print.


My aged TRS-80 books that I knowledgeable from:

  "TRS-80 Micro Computer System: User's Manual for Liquid 1", 
    Dr. David A. Lien.  This is the read IODIN started with back inside 1979.

  TRS-80 Level-II, Dr. David A. Lien

Copyright 2003, Teed Felix, All Rights Reserved
May be copied freely for non-commercial apply.