QBASIC-PROGRAMMING LANGUAGE


INTRODUCTION

BASIC (Beginner’s All-purpose Symbolic Instruction Code) is one of the popular high level programming language. BASIC was developed by Professor John G. Kemeny and Thomas Kurtz in 1964. BASIC is very simple and easy to learn. BASIC gives clear ideas to the learners about the user of logical expressions, the way of writing instructions and executions of the instructions. There are many different versions of BASIC. QBASIC is one of the versions of BASIC. Some other versions of BASIC are GWBASIC, Quick BASIC, Turbo BASIC, Visual BASIC, etc.

QBASIC is a high level programming language that allows us to write programs. BASIC uses English like words and mathematical symbols to write programs. The programs written in QBASIC need to be converted into machine codes. QBASIC provides working area to write programs and QBASIC has its own Interpreter. QBASIC converts one statement of a program into machine code at a time. After the execution of the previous statement, it converts another statement of the program into machine code and so on. For this reason, QBASIC is also called an Interpreter.

QBASIC Editor checks syntax errors and capitalizes QBASIC reversed words. QBASIC Editor provides all the facilities that are required for programs. In the QBASIC Editor; you can write, edit, run and debug programs.


FEATURE OF QBASIC
Some features of QBASIC are listed below:
a. QBASIC does not use technical terminology (word) to write statements.
b. QBASIC automatically checks syntax.
c. QBASIC capitalizes the reserved words.
d. QBASIC keeps the same variable name used in a program to identical form.
e. QBASIC allows you to break lengthy programs into modules.
f. QBASIC interprets a statement of a program at a time to CPU.


LOADING QBASIC
QBASIC programming language consists of two files: QBASIC.EXE and QBASIC.HLP. Normally these files are found in a folder named ‘QBASIC’ which is in drive C:.

To start QBASIC, follow these steps.
  1. Click the Start button.
  2. Point to All Programs and then Accessories.
  3. Select Command Prompt. It displays Command Prompt Window.
  4. To move to the root directory, at DOS prompt, type CD\ and press Enter key.
  5. At C:\> prompt, type CD QBASIC and press Enter key.
  6. At C:\ QBASIC> prompt, type qbasic and press Enter key. It will display QBASIC Welcome Screen.
  7. Press Esc key to get QBASIC Editor Screen.


QBASIC EDITOR SCREEN
QBASIC editor is the window where you write programs. The editor provides all the facilities to write programs and editing them.

QBASIC Editor Screen has four parts.
a. Menu Bar.
b. Program Window
c. Immediate Window
d. Status Bar

a. Menu Bar
The Menu Bar consists of list of commands like File, View, Search, Run, Debug, Options and Help. These menus again have some sub commands such as FILE= New, Open, Save, Save As, Print, Exit. EDIT= Cut, Copy, Paste, Clear, New Sub, New Function. VIEW= Subs, Spilt, Output Screen. SEARCH= Find, Repeat Last Find, Change. RUN= Start, Restart, Continue. DEBUG= Step, Procedure Step, Trace On, Toggle Breakpoint, Clear All Breakpoints breakpoints, Set Next Statement. OPTIONS= Display, Help Path, Syntax Checking.

b. Program Window
The upper window which is titled as ‘Untitled’ is the window where you write programs. This window is called Program Window. To see the output of the statements written in this window, you need to press Shift + F5 key.

c. Immediate Window
The lower window which is titled as ‘Immediate’ is known as Immediate Window where you test commands, expressions etc. As soon as you press Enter key, it displays the output on the screen.
Note: F6 function key is used to switch from Program Window to Immediate Window and vice versa.

d. Status Bar
The status bar shows short cut keys and the location of the cursor on the screen.


RUNNING A PROGRAM
After entering a set of instructions in the Program Window, you may want to see the output of the program. To see the output of the program you need to run a program. When you run a program QBASIC converts and directs each statement of a program at a time to the CPU. To run (execute) a program
Press Shift + F5 key or press Alt, R, S.
Note:
F5 key is used for continuing the program from the previous stop statement.

SAVING A PROGRAM
You need to save a program for the future use. Sometimes you need to save incomplete program so that you can complete at next time. To save a program, follow these steps:
  1. Press ALT + F key.
  2. Highlight Save As Option.
  3. Press Enter key. It displays Save Dialog Box.
  4. Enter Filename in the Filename text box.
  5. Press Enter key.

Note:
  • When you supply filename just use not more than eight characters for filename.
  • QBASIC automatically adds an extension as .BAS for the program file.

CLEARING PROGRAM WINDOW
To write a new program you need to remove the previous program from the Program Window. To clear or remove the previous program, follow these steps.
a) Press ALT key.
b) Highlight New option and press Enter key. OR. Press F, N keys.


OPENING AN EXISTING PROGRAM
To open an existing program in the Program Window, follow these steps.
a. Press Alt key.
b. Press F key.
c. Highlight Open command and press Enter key.
d. Select a program file the list of files displayed in the Open Dialog box and press Enter key.

EXITING QBASIC
To exit from the QBASIC, follow these steps.
a. Press ALT key. It will activate menu.
b. Press F or Enter key.
c. Press X or select Exit command under File menu and press Enter key.



0 comments:

Post a Comment