Qbasic Tutorial: Chapter 2
Storing data in the computer memory
Data types: Constants and Variables
You may need to store data in the computer when writing your program.
Data is classified into 2 types:
- Numbers
- Character Strings
Example of numbers:
Examples of character strings:
| "Hello! how are you?" "John
Smith" "14 Royal Road"
"$123" |
Characters consist of letters, numbers, symbols and special characters.
To store data in the memory you will need to put them first in memory
variables or constants.
A memory variable will store values that vary, change.
A memory constant will store values that remain constant (i.e. they don't
change).
The Computer Memory
The memory of the human being contains millions of cells that store the
different information that you have acquired in your life. Similarly the computer memory could be represented as storage cells.
Each cell can be
given a name or an address as follows:
| Value |
10 |
+5 |
0.32 |
-1.234 |
| name
of cell |
a |
b |
c |
d |
| Value |
Hello! How are you |
John Smith |
14 Royal Road |
$123 |
| name
of cell |
a$ |
b$ |
c$ |
d$ |
[ Previous Index
Next
]
|