Programming : QBASIC

19
{ Introduction Interface Features Rules Data Types of Mode Keywords Commands Reminders Simple Activity

Transcript of Programming : QBASIC

{ Introduction Interface Features Rules Data Types of Mode Keywords Commands Reminders Simple Activity

It was invented in 1963 at Dartmouth College

It is an interpreter which means it reads every line, translates it and lets the computer execute it before

reading another.

The founders are John George Kemeny and Tom Kurtzas

It is a user friendly language.

It is widely known and accepted programming

language.

It is one of the most flexible languages , as modification

can easily be done in already existing programs. Language is easy since the

variables can be named easily and uses simple English phrases with

mathematical expressions.

All Q-basic language are made up of series of statements, which are executed in the order in which they are written.

Every statements should have at least one Q-Basic command word. The words that BASIC recognizes

are called KEYWORDS.

All the command words have to be written using some standard rules , which are called “Syntax Rules”. Syntax is the grammar of writing the statement in a language. Syntax errors are generated when improper

syntax is detected.

Data is a collection of facts and figures that is entered into the computer through the keyboard. Data is of two types: Constant and Variable.

CONSTANT : Data whose value does not change

a) Numeric Constant : negative or positive numbers.b) Alphanumeric Constant : Numbers or alphabets

written within double qoutes.

Variable : Data whose value is not constant.

a) Numeric Variable : variable that holds a numeric constant for calculations.

b) Alphanumeric Variables : variable that holds an alphanumeric variable which cannot be

used for calculations.

1. Direct Mode : It accepts single line instructions from the user and the output is viewed as soon as enter key is pressed.

2. Program Mode : It is used to type program which is stored in the memory, They have line numbers.

V. Nuval | C. Repollo

1.) LIST is used to list the program on the screen.

2.) RUN is used to execute the program.

3.) LLIST is used to list the program as a hardcopy.

4.) LPRINt is used to get the output of the program on the hard copy.

5.) NEW is used to clear the memory of the existing program.

6.) SYSTEM is used to take you back to the dos prompt

7.) PRINT is used to view the display on the screen

8.) CLS is used to clear the screen.

9.) RME is used to show the position of the mistake.

10.) SAVE is used to save the program.

11.) LOAD is used to load the program from the disk to the memory.

1. CLS is used to clear the screen.

2. PRINT is used to display the output on the screen.

3. REM gives an explanation of the program or the statement in the program thereby making the program more understandable to do the reader.

4. LET assigns a value to a variable in a program.

5. END is used at the end of the program to signal ending.

6. INPUT allows the user to enter a value for the variable while running the program.

7. DELETE is used to delete a line number in a program.

A Q-Basic program consists of the lines containing:

1.) a line number

2.) A Q-Basic keyword like PRINT,END etc.

3.) Each program line begins with positive number.

4.) No two lines should have same numbers.

RUN is the command used to execute the program and get the output on the screen.

It is possible to overwrite lines with the new statements, but if you want to write

a totally new program , use a NEW command

In order to exit the Q-Basic program SYSTEM command

is used.

Command is a special function that tells the Q-Basic interpreter to do something.

The PRINT command tells the Q-Basic interpreter to print something to the screen.

PRINT “HELLO WORLD”

FIRST PROGRAMMED WORDS IN THE

HISTORY.

An expression is something that interpreter calculates.

1+1 (returns 2)100-47 (returns 53)

AND NOW YOU CAN START A SIMPLE PROGRAM USING Q-BASIC !

THANK YOU

ABOUT THE AUTHORS

VALERIE NUVAL AND CHARLEEN REPOLLO ARE STUDENTS AT JUAN G. MACARAEG NATIONAL HIGH SCHOOL LOCATED AT

BINALONAN,PANGASINAN,PHILIPPINES. THIS SLIDESHOW IS MADE AND UPLOADED AS A

PROJECT FOR THEIR COMPUTER PROGRAMMING CLASS AND WILL BE PASSED

TO THEIR SUBJECT TEACHER MR.ANGEL CORONA.