Tuesday 24 November 2015

Thursday 5 November 2015

Classs 6 - QBASIC

Ch 9 QBASIC statements
 
QBASIC is programming language, which is suitable for a beginner who wants to learn a   programming language. It is simple and super easy.

Character Set :
It is the set of characters allowed to use in QBASIC.
It consists of
I. alphabets(a- z and A - Z)
II. numbers (0 to 9)
III. special characters (@,!,#,?,;,. etc

Constants :
The values which do not change are called constants. There are two types Numeric constant and String  constant.
 
Numeric Constant :
 
  •   It includes whole numbers ,decimal numbers.
  •   It can be a positive number or a negative number.
  •   Should not have special characters.

Valid numeric constants :

 124
 45.78
- 7

Invalid numeric constants :

Rs.500
#1


String Constants :

  • It includes alphabets ,numbers and special characters.
  • Should be within double quotes.

Valid string constants :

"Cotton Boys"
"Computers"
"150 years"

Invalid string constants

Bangalore (because no quotes)

Variables

The values that may or may not change are called variables. There are two types
  1. Numeric Variable
  2. String Variable
Numeric Variable

It stores numeric constants. There are some rules in naming a variable.
  • It should start with an alphabet.
  • Remaining letters if any, can be an alphabet or a number.
  • No reserved words(like let, input, print, rem, cls .. etc)
  • No special characters.
Valid numeric variables:
  1. A
  2. sum
  3. X5
Invalid numeric variables :
  1. sum of     -    (space)
  2. 8line        -    (First letter is number)
String Variable
 It stores string constants.
  • It should start with an alphabet.
  • Remaining letters if any, can be an alphabet or a number.
  • No reserved words(like let, input, print, rem, cls .. etc)
  • No special characters except $.
  • It should end with a $ symbol.
Valid string variable
  • boy$
  • d3$
  • comp$