So you heard a long time ago about some programming language called QBasic. This language isn't used much anymore except in its new incarnation as visual basic. If you learn QBasic, vb is quite simple. So what am I going to show you today? How to write a simple program in QBasic. First of all Basic stands for "Quick Beginner's All-purpose Symbolic Instruction Code" and was developed in the 1960's as a simple way to learn programming. This first simple program will use multiplication to find the area of a room.

First of all the program in its entirety:


CLS
INPUT "Please enter the length"; Length
INPUT "Please enter the width"; Wdth
LET Area = Length * Wdth
PRINT "The area is"; Area
END

QBasic is a very simple language, and for those programmers who are reading this that have never dealt with QBasic, this is an unstructured programming language meaning that you can use the GOSUB command to jump around to any place in the program at any time. Many experienced programmers do not like this feature, but when I took a class for this, it saved my life while writing programs. Also in this language there is no need to declare variables. Now I will explain the program line by line.

CLS
This command tells QBasic to clear the screen. Often times this is needed because old data from the same program doesnt automatically disappear.

INPUT "Please enter the length "; Length
This tells Basic to accept input from the user, and displays a message with the text in it. This user input is then assigned to the numeric variable "Length".

INPUT "Please enter the width "; Wdth
This is the same as the "Length" variable except one thing. If you havent noticed Ive been misspelling the variable "Wdth". This is because the word "Width is a word that is reserved.

LET Area = Length * Wdth
This is the mathematical function in the program. Once again since the variables don't have to be declared, it is easy to use "Area".

PRINT "The area is"; Area
Shows on the screen the sentence followed by the results of your calculation.

END
After you are finished you must tell QBasic that the program is finished. This is accomplished using the "END" command.

A program of a similar nature written in java, or C++ would have taken a longer to write and more code. There is a lot more to QBasic, but this should get you started on your way. I feel that QBasic still has use as a teaching aid and that it is important to learn. If you need a QBasic compiler, Microsoft has a small one known as QBasic. There isnt anywhere free to find it except inside a textbook at the public library. If there are any mistakes in my post feel free to correct them.