·
QBASIC
-
QBASIC
is an ideal programming language for beginners because of its intuitive
commands, simple structure and flexibility.
-
The
full form of QBASIC is Quick Beginners All Purpose Symbolic Instructions
Code.
-
QBASIC
is developed by Microsoft in 1991.
-
The
extension of QBASIC is “.bas”.
·
Keywords
-
Predefined
word which operation and meaning is defined in compiler. It means we can not
use keywords for other uses.
E.g. :- PRINT, INPUT, WHILE, FOR, etc.
· Variable
-
Variable
which value can change according to the users.
-
If
we want to take string type (i.e. letter) value in a variable then we must put
dollar sign ($). After name of that variable.
*
There are some rules defined for variables :-
-
Keywords
are not allowed.
-
Digits
are allowed.
-
Variable
must be started with alphabet.
-
Blank
space are not allowed.
-
Special
characters except dot (.) and dollar ($) are not allowed.
* Variables are of two types in QBASIC
·
Numeric
-
It
stores only numeric data.
-
i.e. English
book = 100, School = 20000 etc.
·
Alphanumeric
-
It
stores only non - numeric data.
-
Its
name must be suffix with $ sign.
-
i.e.
name$=”Techworld”
·
Constant
-
These
are fixed values, which are processed and put it into variable.
* Constant are of two types in QBASIC
· Numeric
-
Those
data which can be calculated that data is called numeric data.
-
These
are numbers.
-
i.e. 34, 45,
9, 23, 89 etc.
· Alphanumeric
-
Those
data which can not be calculated that data is called alphanumeric data.
-
These
are represented in double quotation mark { “ “ }.
-
i.e.
“Techworld”, “India”, “Bharat”, “6556” etc.
·
Operators
-
It
always perform some operation on its operands.
-
Operands
are values on which operators perform operation.
-
i.e. +, -,
/, *, etc.
· Operator are classified in four
categories in QBASIC
*
Assignment Operators :
-
It
is used to assign value to variables.
-
Equal
sign { = } is used.
-
e.g.
:- fees = 1400, name$=”Rahul”
* Arithmetic Operators :
-
These
operation performs arithmetic operations.
Operators
|
Operations
|
+
|
Used for addition
|
-
|
Used for subtraction
|
*
|
Used for multiplication
|
/
|
Used for division
|
^ or **
|
Used for power
|
Mod (modulus )
|
Used for remainder
|
*
Relation Operators :
-
It
is used for comparison of its operands.
Operators
|
Operations
|
<
|
Used for less than comparison
|
>
|
Used for greater than comparison
|
=
|
Used for equality comparison
|
= > or > =
|
Used for greater than or equality comparison
|
< = or < =
|
Used for less than or equality comparison
|
< > or > <
|
Used for no equality comparison
|
* Logic Operators :
-
It
performs logical operations like AND, OR & NOT.
-
AND & OR
used for combination more than one relation operator.
-
NOT is used
for reverse of resultant.
AND :- In this operator, if all condition are true then resultant become true otherwise false.
OR :- In this operator, if all condition are false then resultant become false otherwise true.
NOT :- In this operation, if condition is true then it gives false and if result of condition is false then it gives true.
AND :- In this operator, if all condition are true then resultant become true otherwise false.
Condition 1
|
Condition 2
|
Resultant
|
True
|
True
|
True
|
True
|
False
|
False
|
False
|
True
|
False
|
False
|
False
|
False
|
OR :- In this operator, if all condition are false then resultant become false otherwise true.
Condition 1
|
Condition 2
|
Resultant
|
True
|
True
|
True
|
True
|
False
|
True
|
False
|
True
|
True
|
False
|
False
|
False
|
NOT :- In this operation, if condition is true then it gives false and if result of condition is false then it gives true.
Condition
|
Resultant
|
True
|
False
|
False
|
True
|
* Two main command which we use to do our operation’s
1. Input command :- It is used for inputting values / data from the keyboard.
Syntax : INPUT variable1, variable 2, ……
INPUT “Message” ; variable1, variable2, …
E.g. INPUT A , B
INPUT “Enter two value” ; A , B
INPUT “Enter three values” ; A , B , C
2. Print command :- It is used for outputting on or more than one data.
Syntax : PRINT <data/expression> separator <data/expression> separator
Comma { , } and semicolon { ; } are used for separators.
E.g. PRINT rupees, 10, 1200
PRINT “India” , “Bharat”
PRINT name$, age
0 Comments
Thank You ! For your love