Follow Along
I'm assuming you will be following along with QBASIC in front of you. This won't be much fun if you aren't. So power up the computer and get QBASIC's blue screen up in front of you. Go ahead and press the <Esc> key to "clear this dialog box" when it asks you.
QBASIC's Screen
Before we start, let's take a look at QBASIC's screen. At the top is QBASIC's menu. The menu has the following items: File, Edit, View, Search, Run, Debug, Options, and Help.


Clicking on any of these with the mouse will show more selections.
Just under the menu is the word "Untitled". This means we haven't given the current program a name. This will change when we learn to save programs. The big blue area with the blinking cursor (
_
) is where we can enter our programs.
These are the most important areas to know for right now. We will learn more about the rest of QBASIC's screen as we go along.
QBASIC Editor
If you've used your computer to do school work or write a report, you'll notice that most of the editing keys (<Backspace>, <Delete>, <Insert>...) work just the way they always do. In case you haven't used these keys before, here's a list:
- <Backspace> - Removes the character to the left of the cursor
- <Delete> - Removes the character at the cursor
- <Left Arrow> - Moves the cursor left
- <Right Arrow> - Moves the cursor right
- <Up Arrow> - Moves the cursor up
- <Down Arrow> - Moves the cursor down
- <Home> - Moves the cursor to the start of a line
- <End> - Moves the cursor to the end of a line
Your First Program.
With the blinking cursor (_
) at the top-left corner of the screen, type this:PRINT "Welcome to QBASIC. Your wish is my command."
Make sure it looks exactly like that. The quotation marks ("
) are very important. If you make any mistakes, use the <Backspace> key to correct them.
Running Your Program.
That's great, but what does it do? 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 will see a menu with a list of selections (Start, Restart, and Continue). Click on Start to run your program. You may have to look around on the screen a bit, but you should find your message:
C:\WINDOWS> qbasic
Welcome to QBASIC. Your wish is my command.
PRINT prints things to the screen. Don't forget to put what you want to say in double-quotation marks (").
Press any key to continue?
At the bottom of the screen you will see a message "Press any key to continue". Press <Enter> to get back to QBASIC. This is QBASIC's way of giving you enough time to see what your program did.
As a cool shortcut, use ? for PRINT. Try it. Press <Enter> to start typing on a new line. Now type this:
? "Programming is fun."
and press <Enter> again.
Isn't that nice? The ? becomes the word PRINT. That should save us a lot of typing in the long run.
You can try running the program again (remember? Click on Run, then Start on the menu). You should see something like this:
C:\WINDOWS> qbasic
Welcome to QBASIC. Your wish is my command.
Welcome to QBASIC. Your wish is my command.
Programming is fun.
Learned
- QBASIC screen
- Editing Keys
- Run | Start
- ?
No comments:
Post a Comment