Welcome to Basic Basic, a grouping of lessons on how to use the QBasic programming language. If you are reading this, then it is most likely that you want to learn how to program in QBasic, and have several questions. I hope to answer all of them and more in this book.
First, you may be wondering what QBasic exactly is. Well, there is a simple answer - QBasic is a programming language written for computers back in 1975, by Bill Gates and Paul Allen, and has been the accepted standard ever since. Why? Because of its ease of use, its English-like commands, and its power.
QBasic stands for Beginner's All-Purpose Symbolic Instruction Code. Several of its commands are pure English - PRINT, LET, and many others. It has a simple structure for its programs: its lines are numbered(10, 20, 30, etc.) and are executed in order.
But why should you use QBasic? What's in it for you? Many things are in it for you. When you learn QBasic, you also learn many of the fundamentals of other programming languages. You also can create programs easily. Once you get into it, you'll find that the fun in creating programs is worth coming back to.
By the end of this book, you should know many things about the QBasic programming language, and you will be able to write excellent programs that are useful to you and your friends.
QBasic is very easy to use. Almost every single computer has it included with it. If you don't already know where QBasic is located on your computer, check the \DOS directory, or use a program to find QBASIC.EXE.
To start using QBasic, load it up from the DOS prompt, and it should look something like the DOS editor. I know you'd like to get started right away, so I'll cut to the chase. Here's a sample program for you to type in:
PRINT"This is my first program!"
This is just a list of commands that the computer will interpret and execute. Go up to the "RUN" menu and click "START". The scren will clear, and look something like this, with a "Press any key to continue" on the bottom of the screen.
This is my first program!
Notice it doesn't say CLS, or PRINT, or anything. It does give you a "Press any key to continue" message, but that's just QBasic's way of telling you it's done with it's work.
To begin with the explanation, the command 'CLS' stands for CLear Screen, and PRINT is quite self-explanatory. Just make sure that when you're PRINTing, have quotes on each side of what you want the screen to display. Fool around with the two commands until you get used to them. People who are already familiar with the menus at the top of the screen (and their function) can skip the next paragraph.
To begin a new program, go to the "FILE" menu and click "NEW." BEWARE - any program in memory will be LOST FOREVER if it is not saved. If you want to save a program, go to the "FILE" menu and click "SAVE." QBasic will prompt you for a file name, and your program will be saved to disk. If you want to load that program again, go to the "FILE" menu and click "LOAD". You will get a dialog of what QBasic files are in your directory. Double-click on the one you want to load.
Questions and Exercises
1. Create a program with this screen output:
Welcome to Computer Trivia, by Yours Truly.
Did you know that a kilobyte is not just
1000 bytes, but 1024?
2. What is wrong with the following program?
PRINT "This is a cool program by Me!"
You now know the two most QBasic commands and building blocks of QBasic programs - CLS and PRINT. Be ready for more fun ways to learn information as well as make programs for yourself, your friends, and anyone you want. Have fun, this is just the beginning...