Computer Science Education | Programming Language Tutorials For Beginners

QBASIC TUTORIAL 1 - Introduction & Print Command

INTRODUCTION
You've probably used computers to play games, and to write reports for school. It's a lot more fun to create your own games to play on the computer. This tutorial will help you get started by using QBASIC.
QBASIC is a programming language. With a programming language you can tell the computer what you want it to do. It's a lot like giving someone directions to your house.
The computer follows each step and does exactly what you tell it. By programming the computer you can solve math problems, create art or music, and even make new games.
It's all up to you.
The best way to start with this tutorial is to type in some of the small programs you'll find in each of the tutorials. Then change the programs to do what you want them to do.
Before long, you'll be writing your own programs.

TUTORIAL 1 - GETTING STARTED
Setting up your User Drive
Click on START (Located on the bottom left of your screen) – Click on MY COMPUTER – Double click on your user drive (computer). (The drive that ends with: (C:)

Getting to QBasic
To run QBASIC we need to get to the QBasic editor.
Click on START (Located on the bottom left of your screen) – Click on ALL PROGRAMS – click on: SHORTCUT TO MICROSOFT QUICK BASIC. This will open the editor. Press on the ESC (escape) key to clear the screen and exit the Survival guide.


To change the interface of the QBasic, go to options at the top right conrner of the tools bar, click on display and make the necessary adjustments you desire.


PRINT - Running Your First Program:
With the blinking cursor ( _ ) at the top-left corner of the screen, type this:

     PRINT "Hello World"
     PRINT "This Is QBasics Tutorial 1"

Make sure it looks exactly like that. The quotation marks (") are very important. If you make any mistakes, use the Backspace or Delete 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. On the QBasic output screen you should see:


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.
Key to Easy Running
Another way to run your program is to press the F5 key. Try running your program a second time, by pressing the F5 key.
What Just Happened?
The first word of your program (PRINT) is a command that instructs the computer to print to the QBasic editor’s output screen whatever is inside the quotation marks.
Notice when you ran the program a second time, there was a second output line. This is because you never told the computer to erase the screen before printing the next line.

Saving Your Program.
Remember to always save your program before running it. To save your program, click on file, and scroll to save, it wil bring out a sub-screen like the one shown below, choose the drive, in the case your drive is [-C-] then type the name you which to save it with.
To open a QBasic program you must open the QBasic editor first and then open the 
file via the FILE menu and the OPEN command.



To Exit QBasic
After saving your first program, and you wish to exist QBasic, click on File and scroll to exit.


Share:

1 comment:

  1. Please after reading try commenting, it encourages us to do more and post more tutorials. Thanks. 😃

    ReplyDelete

Popular Posts

Elitcode - Learning Start Here

Elitcode Blog Archive