0% found this document useful (0 votes)
9 views

History and Generation of Computer

Uploaded by

Sanjeev Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

History and Generation of Computer

Uploaded by

Sanjeev Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 68

HISTORY AND

GENERATION OF
COMPUTER
Chapter 1
First use of the word ‘Computer’

 Originally calculation were computed by


humans.
 Whose job title was computers.
 The first use of the word "computer" was
recorded in 1613, referring to a person who
carried out calculations, or computations, and
the word continued with the same meaning until
the middle of the 20th century. From the end of
the 19th century onwards, the word began to
take on its more familiar meaning, describing a
machine that carries out computations.
Tally sticks
 Tally sticks are an ancient mnemonic device
(memory aid) to record and document
numbers, quantities, or even messages. While
the origin of this technique is lost in prehistory,
archaeological proof of the existence of such
devices is ample
Abacus
 The word Abacus is derived from the Greek
"Abax" meaning counting board and the original
types of Abacus were stone slates with dust
covering them and a stylus used for marking
numbers.
 The Abacus is an ancient mathematical
instrument used for calculation it is one of the
world’s first real calculating tools.
 The history of abacus dates back to nearly
2500 years back (B.C.).
 The Abacus was invented in Babylonia in 2400 B.
C. and used in china in around 500 B.C.
Modern Abacus Earlier Abacus
Napier's Bones
 In the early 17th century, John Napier, a
Scottish mathematician, invented another
calculating tool. It used marked strips of wood
or bone, side by side, to multiply and divide.
This tool became known as "Napier's Bones."
Napier's Bones
Slide Rule
 William Oughtred (5 March 1574 – 30 June 1660) was an
English mathematician born in Eton
 He is credited as the inventor of the slide rule in 1622.
 After John Napier invented logarithms, and Edmund
Gunter created the logarithmic scales (lines, or rules)
upon which slide rules are based.
 Not normally used for addition or subtraction.
The Pascaline
 Blaise Pascal, the father of Pascaline.
 In 1642, at the age of 19, a French mathematician by
the name of Biaise Pascal, invented the Pascaline.
 Normally used for addition or subtraction.
 But it was too expensive
Step Reckoner
 In 1672, German inventor Gottfried Wilhelm
Liebniz invented Step Reckoner
 The Liebniz Calculator can addition, subtraction
multiply, divide, and find square roots of
numbers
Jacquard Loom
 In 1801, Jacquard invented the Jacquard loom. It
was a weaving machine that was controlled by
punched cards.
 While the loom was being pumped, cards with holes
in them were attached together in a pattern through
which strings of thread were automatically fed.
 These cards would feed the right pieces of thread
into the loom to make a beautiful cloth.
Charles Babbage & Analytical
Engines

Analytical Engine
 The Analytical Engine was a mechanical computer
that can solve any mathematical problem. It uses
punch-cards similar to those used by the Jacquard
loom and can perform simple conditional operations.
Difference Engine
 The computing machines made in the 1900s, and
even those today are based on the designs of the
Difference Engine and the Analytical Engine. This is
why charles Babbage is known as the "Father of
Computers."
Tabulating Machine
 In 1890, 50 years after charles Babbage's
death, Hollerith invented a machine called
the tabulating Machine.
 To assist in summarizing information and
accounting
Howard Mark I
 In 1944, IBM paid engineers to build Aiken's machine.
 Called the Mark I, it was made up of 78 adding
machines and desk calculators that were connected
by almost 500 miles of wires. In one second, the Mark
I could add three eight-digit numbers.
 The first electro mechanical computer.
 Also known as IBM Automatic Sequence Controlled
Calculator (ASCC).
Generation of computer
 The period of first generation was 1946-1959.

First generation of computer started with using vacuum tubes as


the basic components for memory and circuitry for CPU(Central
Processing Unit). These tubes like electric bulbs produced a lot of
heat and were prone to frequent fusing of the installations,
therefore, were very expensive and could be afforded only by very
large organisations.

In this generation mainly batch processing operating system were


used. In this generation Punched cards, Paper tape, Magnetic tape
Input & Output device were used.

There were Machine code and electric wired board languages used.
Generation of computer
The main features of First Generation are:
 Vacuum tube technology
 Unreliable
 Supported Machine language only
 Very costly
 Generate lot of heat
 Slow Input/Output device
 Huge size
 Need of A.C.
 Non portable
 Consumed lot of electricity
Some computer of this generation were:
 ENIAC
 EDVAC
 UNIVAC
 IBM-701
 IBM-650
Generation of computer
The period of second generation was 1959-1965
 This generation using the transistor were cheaper, consumed

less power, more compact in size, more reliable and faster


than the first generation machines made of vaccum tubes. In
this generation, magnetic cores were used as primary
memory and magnetic tape and magnetic disks as secondary
storage devices.
In this generation assembly language and high level
programming language like FORTRAN, COBOL were used.
There were Batch processing and Multiprogramming
Operating system used.
Generation of computer
The main features of Second Generation are:
 Use of transistors
 Reliable as compared to First generation computers
 Smaller size as compared to First generation computers
 Generate less heat as compared to First generation computers
 Consumed less electricity as compared to First generation computers
 Faster than first generation computers
 Still very costly
 A.C. needed
 Support machine and assmebly languages
Some computer of this generation were:
 IBM 1620
 IBM 7094
 CDC 1604
 CDC 3600
 UNIVAC 1108
Generation of computer
The period of third generation was 1965-1971
 The third generation of computer is marked by the use of

Integrated Circuits (IC's) in place of transistors. A single


I.C has many transistors, resistors and capacitors along
with the associated circuitry. The I.C was invented by Jack
Kilby. This development made computers smaller in size,
reliable and efficient.

 In this generation Remote processing, Time-sharing, Real-


time, Multi-programming Operating System were used.
High level language (FORTRAN-II TO IV, COBOL, PASCAL
PL/1, BASIC, ALGOL-68 etc.) were used during this
generation.
Generation of computer
The main features of Third Generation are:
 IC used
 More reliable
 Smaller size
 Generate less heat
 Faster
 Lesser maintenance
 Still costly
 A.C needed
 Consumed lesser electricity
 Support high level language
Some computer of this generation were:
 IBM-360 series
 Honeywell-6000 series
 PDP(Personal Data Processor)
 IBM-370/168
 TDC-316
Generation of computer
Period of Fourth Generation was 1971-1980
 The fourth generation of computers is marked by the use of Very

Large Scale Integrated (VLSI) circuits. VLSI circuits having about


5000 transistors and other circuit elements and their associated
circuits on a single chip made it possible to have microcomputers
of fourth generation. Fourth Generation computers became more
powerful, compact, reliable, and affordable. As a result, it gave
rise to personal computer (PC) revolution.

 In this generation Time sharing, Real time, Networks, Distributed


Operating System were used.

 All the Higher level languages like C and C++, DBASE etc. were
used in this generation.
Generation of computer
The main features of Fourth Generation are:
 VLSI technology used
 Very cheap
 Portable and reliable
 Use of PC's
 Very small size
 Pipeline processing
 No A.C. needed
 Concept of internet was introduced
 Great developments in the fields of networks
 Computers became easily available
Some computer of this generation were:
 DEC 10
 STAR 1000
 PDP 11
 CRAY-1(Super Computer)
 CRAY-X-MP(Super Computer)
Generation of computer
The period of Fifth Generation is 1980-till date
 In the fifth generation, the VLSI technology became ULSI (Ultra Large

Scale Integration) technology, resulting in the production of


microprocessor chips having ten million electronic components. This
generation is based on parallel processing hardware and AI (Artificial
Intelligence) software. AI is an emerging branch in computer science,
which interprets means and method of making computers think like
human beings. All the Higher level languages like C and C++,
Java, .Net etc. are used in this generation.

AI includes:
 Robotics
 Neural networks
 Game Playing
 Development of expert systems to make decisions in real life
situations.
 Natural language understanding and generation.
Generation of computer
The main features of Fifth Generation are:
 ULSI technology

 Development of true artificial intelligence

 Development of Natural language processing

 Advancement in Parallel Processing

 Advancement in Superconductor technology

 More user friendly interfaces with multimedia features

 Availability of very powerful and compact computers at cheaper

rates
Some computer types of this generation are:
 Desktop

 Laptop

 NoteBook

 UltraBook

 ChromeBook
Augusta Ada King-Noel (the first
computer programmer)
 Augusta Ada King-Noel, Countess
of Lovelace ( 10 December 1815 – 27
November 1852) was an English
mathematician and writer, chiefly
known for her work on Charles
Babbage's proposed mechanical
general-purpose computer, the
Analytical Engine. She was the first to
recognise that the machine had
applications beyond pure calculation,
and created the first algorithm intended
to be carried out by such a machine. As
a result, she is often regarded as the
first to recognise the full potential of a
"computing machine" and the first
computer programmer.
 The mechanical memory units were unique in their
design and were patented by Konrad Zuse from 1936
to 1938 in Germany. This was the first programmable
computer. The machine was only capable of executing
instructions while reading from the punched tape
reader, so the program itself was not loaded in its
entirety into internal memory in advance.
 Being completed by 1942, the Atanasoff-Berry
Computer (ABC) was the first electronic computer. It
was designed and built by John Vincent Atanasoff
and his assistant, Clifford E. Berry. At the time,
Atanasoff was teaching Physics, and Berry was a
graduate student in Electrical Engineering. They
worked on the computer from 1939 until 1942 when
it was abandoned due to WWII.
Computer Organization
A computer performs five major operations or functions
irrespective of its size and make. These are
 it accepts data or instructions as input,

 it stores data and instruction

 it processes data as per the instructions,

 it controls all operations inside a computer, and

 it gives results in the form of output.

Functional Units:
a. Input Unit: This unit is used for entering data and
programs into the computer system by the user for
processing.
b. Storage Unit: The storage unit is used for storing data
and instructions before and after processing.
Block diagram of computer
Functional Units:
c. Output Unit: The output unit is used for storing the result as
output produced by the computer after processing.
d. Processing: The task of performing operations like arithmetic
and logical operations is called processing. The Central Processing
Unit (CPU) takes data and instructions from the storage unit and
makes all sorts of calculations based on the instructions given
and the type of data provided. It is then sent back to the storage
unit. CPU includes Arithmetic logic unit (ALU) and control unit (CU)
 Arithmetic Logic Unit: All calculations and comparisons, based

on the instructions provided, are carried out within the ALU. It


performs arithmetic functions like addition, subtraction,
multiplication, division and also logical operations like greater
than, less than and equal to etc.
 Control Unit: Controlling of all operations like input, processing

and output are performed by control unit. It takes care of step by


step processing of all operations inside the computer.
Functional Units:
 Memory
 Computer’s memory can be classified into two types; primary

memory and secondary memory


a. Primary Memory can be further classified as RAM and ROM.
 RAM or Random Access Memory is the unit in a computer

system. It is the place in a computer where the operating system,


application programs and the data in current use are kept
temporarily so that they can be accessed by the computer’s
processor. It is said to be ‘volatile’ since its contents are accessible
only as long as the computer is on. The contents of RAM are no
more available once the computer is turned off.
 ROM or Read Only Memory is a special type of memory which

can only be read and contents of which are not lost even when the
computer is switched off. It typically contains manufacturer’s
instructions. Among other things, ROM also stores an initial
program called the ‘bootstrap loader’ whose function is to start the
operation of computer system once the power is turned on.
Functional Units:
b. Secondary Memory
 RAM is volatile memory having a limited
storage capacity. Secondary/auxiliary memory
is storage other than the RAM. These include
devices that are peripheral and are connected
and controlled by the computer to enable
permanent storage of programs and data.
 Secondary storage devices are of two types;
magnetic and optical. Magnetic devices
include hard disks and optical storage devices
are CDs, DVDs, Pen drive, Zip drive etc.
Functional Units:
Hard Disk
 Hard disks are made up of rigid material and are usually a stack of

metal disks sealed in a box. The hard disk and the hard disk drive exist
together as a unit and is a permanent part of the computer where
data and programs are saved. These disks have storage capacities
ranging from 1GB to 80 GB and more. Hard disks are rewritable.
Compact Disk
 Compact Disk (CD) is portable disk having data storage capacity

between 650-700 MB. It can hold large amount of information such as


music, full-motion videos, and text etc. CDs can be either read only or
read write type.
Digital Video Disk
 Digital Video Disk (DVD) is similar to a CD but has larger storage

capacity and enormous clarity. Depending upon the disk type it can
store several Gigabytes of data. DVDs are primarily used to store
music or movies and can be played back on your television or the
computer too. These are not rewritable.
Functional Units:
Input / Output Devices:
 These devices are used to enter information

and instructions into a computer for storage


or processing and to deliver the processed
data to a user. Input/Output devices are
required for users to communicate with the
computer. In simple terms, input devices bring
information INTO the computer and output
devices bring information OUT of a computer
system. These input/output devices are also
known as peripherals since they surround the
CPU and memory of a computer system.
Input Devices
a) Input Devices
 An input device is any device that provides input to a

computer. There are many input devices, but the two


most common ones are a keyboard and mouse. Every
key you press on the keyboard and every movement
or click you make with the mouse sends a specific
input signal to the computer.
 Keyboard: The keyboard is very much like a standard

typewriter keyboard with a few additional keys. The


basic QWERTY layout of characters is maintained to
make it easy to use the system. The additional keys
are included to perform certain special functions.
These are known as function keys that vary in number
from keyboard to keyboard.
 Mouse: A device that controls the movement of
the cursor or pointer on a display screen. A mouse
is a small object you can roll along a hard and flat
surface. Its name is derived from its shape, which
looks a bit like a mouse. As you move the mouse,
the pointer on the display screen moves in the
same direction.
 Trackball: A trackball is an input device used to
enter motion data into computers or other
electronic devices. It serves the same purpose as
a mouse, but is designed with a moveable ball on
the top, which can be rolled in any direction.
 Touchpad: A touch pad is a device for pointing
(controlling input positioning) on a computer display
screen. It is an alternative to the mouse. Originally
incorporated in laptop computers, touch pads are also
being made for use with desktop computers. A touch
pad works by sensing the user’s finger movement and
downward pressure.
 Touch Screen: It allows the user to operate/make
selections by simply touching the display screen. A
display screen that is sensitive to the touch of a finger
or stylus. Widely used on ATM machines, retail point-
of-sale terminals, car navigation systems, medical
monitors and industrial control panels.
 Light Pen: Light pen is an input device that utilizes a
light-sensitive detector to select objects on a display
screen.
 Magnetic ink character recognition (MICR): MICR
can identify character printed with a special ink that
contains particles of magnetic material. This device
particularly finds applications in banking industry.
 Optical mark recognition (OMR): Optical mark
recognition, also called mark sense reader is a
technology where an OMR device senses the presence
or absence of a mark, such as pencil mark. OMR is
widely used in tests such as aptitude test.
 Bar code reader: Bar-code readers are
photoelectric scanners that read the bar
codes or vertical zebra strips marks, printed
on product containers. These devices are
generally used in super markets, bookshops
etc.
 Scanner: Scanner is an input device that
can read text or illustration printed on paper
and translates the information into a form
that the computer can use. A scanner works
by digitizing an image.
Output Devices
 Output Devices: Output device receives information from
the CPU and presents it to the user in the desired from.
The processed data, stored in the memory of the computer
is sent to the output unit, which then converts it into a
form that can be understood by the user. The output is
usually produced in one of the two ways – on the display
device, or on paper (hard copy).
 Monitor: is often used synonymously with “computer
screen” or “display.” Monitor is an output device that
resembles the television screen. It may use a Cathode Ray
Tube (CRT) to display information. The monitor is
associated with a keyboard for manual input of characters
and displays the information as it is keyed in. It also
displays the program or application output. Like the
television, monitors are also available in different sizes.
 Printer: Printers are used to produce paper (commonly
known as hardcopy) output. Based on the technology used,
they can be classified as Impact or Non-impact printers.
 Impact printers use the typewriting printing mechanism
wherein a hammer strikes the paper through a ribbon in order to
produce output. Dot-matrix and Character printers fall under this
category.
 Non-impact printers do not touch the paper while printing.
They use chemical, heat or electrical signals to etch the symbols
on paper. Inkjet, Deskjet, Laser, Thermal printers fall under this
category of printers.
 Plotter: Plotters are used to print graphical output on
paper. It interprets computer commands and makes line
drawings on paper using multicoloured automated pens. It is
capable of producing graphs, drawings, charts, maps etc.
 Facsimile (FAX): Facsimile machine, a device that
can send or receive pictures and text over a
telephone line. Fax machines work by digitizing an
image.
 Sound cards and Speaker(s): An expansion
board that enables a computer to manipulate and
output sounds. Sound cards are necessary for
nearly all CD-ROMs and have become
commonplace on modern personal computers.
Sound cards enable the computer to output sound
through speakers connected to the board, to record
sound input from a microphone connected to the
computer, and manipulate sound stored on a disk.
COMPUTER SOFTWARE
 COMPUTER SOFTWARE:- Computer software is the set of
programs that makes the hardware perform a set of tasks in
particular order. Hardware and software are complimentary to
each other. Both have to work together to produce meaningful
results. Computer software is classified into two broad categories;
system software and application software.
 System Software: System software consists of a group of
programs that control the operations of a computer equipment
including functions like managing memory, managing peripherals,
loading, storing, and is an interface between the application
programs and the computer. MS DOS (Microsoft’s Disk Operating
System), UNIX are examples of system software.
 Application software: Software that can perform a specific task
for the user, such as word processing, accounting, budgeting or
payroll, fall under the category of application software. Word
processors, spreadsheets, database management systems are all
examples of general purpose application software.
PROGRAMMING LANGUAGE

 Computer language or programming language is


a coded syntax used by computer programmers
to communicate with a computer.
 Computer language establishes a flow of
communication between software programs. The
language enables a computer user to dictate
what commands the computer must perform to
process data. These languages can be classified
into following categories.
1. Machine language
2. Assembly language
3. High level language
Machine Language
Machine Language
 Machine language is the lowest and most elementary

level of programming language and was the first type of


programming language to be developed. Machine
language is basically the only language that a computer
can understand and it is usually written in hex.
 In fact, a manufacturer designs a computer to obey just

one language, its machine code, which is represented


inside the computer by a string of binary digits (bits) 0
and 1. The symbol 0 stands for the absence of an
electric pulse and the 1 stands for the presence of an
electric pulse. Since a computer is capable of
recognizing electric signals, it understands machine
language.
Advantages Disadvantages

Machine language makes fast and All operation codes have to be


efficient use of the computer. remembered

It requires no translator to translate


All memory addresses have to be
the code. It is directly understood by
remembered.
the computer.

It is hard to amend or find errors in a


program written in the machine
language.
Assembly Language
Assembly Language
 Assembly language was developed to overcome some of the many

inconveniences of machine language. This is another low-level but


very important language in which operation codes and operands
are given in the form of alphanumeric symbols instead of 0’s and
l’s.
 These alphanumeric symbols are known as mnemonic codes and

can combine in a maximum of five-letter combinations e.g. ADD


for addition, SUB for subtraction, START, LABEL etc. Because of
this feature, assembly language is also known as ‘Symbolic
Programming Language.'
 This language is also very difficult and needs a lot of practice to

master it because there is only a little English support in this


language. Mostly assembly language is used to help in compiler
orientations. The instructions of the assembly language are
converted to machine codes by a language translator and then
they are executed by the computer.
Advantages Disadvantages

Assembly language is easier to


Like machine language, it is also
understand and use as compared to
machine dependent/specific.
machine language.

Since it is machine dependent, the


It is easy to locate and correct errors. programmer also needs to understand
the hardware.

It is easily modified.
High-Level Languages
 High-level computer languages use formats that
are similar to English. The purpose of developing
high-level languages was to enable people to
write programs easily, in their own native
language environment (English).
 High-level languages are basically symbolic
languages that use English words and/or
mathematical symbols rather than mnemonic
codes. Each instruction in the high-level
language is translated into many machine
language instructions that the computer can
understand.
Advantages Disadvantages
A high-level language has to be translated into the
High-level languages are user-friendly machine language by a translator, which takes up
time
The object code generated by a translator might be
They are similar to English and use English
inefficient compared to an equivalent assembly
vocabulary and well-known symbols
language program
They are easier to learn
They are easier to maintain
They are problem-oriented rather than 'machine'-
based
A program written in a high-level language can be
translated into many machine languages and can run
on any computer for which there exists an
appropriate translator
The language is independent of the machine on
which it is used i.e. programs developed in a high-
level language can be run on any computer text
Various Types Of Software
 Well there are two main categories of
software. Some sources divide software
into three categories. Well, this article
will explain each type of software in
details with examples.
There are three types of software:
 System Software

 Application Software

 Utility Software (most of the people

include this as a sub-category of


application software)
System Software
System Software
 Supports the execution and development of other application

software.
 System software is a collection of one or more programs used

to control and coordinate the hardware and other application


software. Generally the system software may perform the
following functions:
 Communicates with hardware devices. Controls and monitors

the proper use of various hardware resources like CPU,


memory, peripheral devices like monitor, printer etc.

Few examples of system software are:


 Operating system

 Programming language translators

 Communication software

 Compiler and Interpreters


Operating System
 An operating system or OS is a software program that
enables the computer hardware to communicate and
operate with the computer software. Without a computer
operating system, a computer and software programs
would be useless. An operating system (OS) is the
program that, after being initially loaded into the
computer by a boot program, manages all the other
programs in a computer. The other programs are called
applications or application programs. The application
programs make use of the operating system by making
requests for services through a defined application
program interface (API). In addition, users can interact
directly with the operating system through a user
interface such as a command line or a graphical user
interface (GUI).
 Examples UNIX, BSD, Haiku, Windows (XP, Vista, 7) and
language translator
 A computer language translator is a
program that translates a set of code
written in one programming language
into a functional equivalent of the code
in another programming language. The
different types of computer translators
are interpreters, source-to-source
compilers, standard compilers,
decompilers, assemblers and
disassemblers.
Compiler
 Compiler is a translator which is used to convert
programs in high-level language to low-level
language. It translates the entire program and
also reports the errors in source program
encountered during the translation.
Interpreter
 An interpreter translates high-level instructions into an
intermediate form, which it then executes. In contrast, a
compiler translates high-level instructions directly into
machine language. Compiled programs generally run
faster than interpreted programs. The advantage of an
interpreter, however, is that it does not need to go
through the compilation stage during which machine
instructions are generated. This process can be time-
consuming if the program is long.
No Compiler Interpreter
Compiler Takes Entire Interpreter Takes Single
1
program as input instruction as input .
Intermediate Object Code is No Intermediate Object Code is
2
Generated Generated
Conditional Control
Conditional Control Statements
3 Statements are Executes
are Executes slower
faster
Memory Requirement : More
4 (Since Object Code is Memory Requirement is Less
Generated)
Every time higher level program
Program need not be
5 is converted into lower level
compiled every time
program
Errors are displayed after Errors are displayed for every
6
entire program is checked instruction interpreted (if any)

7 Example : C Compiler Example : BASIC


Application Software
Application Software
 Application software is a collection of one or more

programs used to solve a specific task.


 Generally software used in banking industry,

airline/railway reservation, generation of telephone or


electricity bills etc. all fall under application software.

Few examples of application software are:


 Word processing software

 Spreadsheet software

 Database software

 Education software

 Entertainment software
Utility Software
Utility Software
 Utility software is a collection of one or more programs

that helps the user in system maintenance tasks and


in performing tasks of routine nature. Utility programs
help the users in disk formatting, data compression,
data backup, scanning for viruses etc.

Few examples of utility software are:


 Anti-virus

 Registry cleaners

 Disk defragmenters

 Data backup utility

 Disk cleaners
QBASIC
 QBASIC is one of the most popular high level
programming language. Various versions of
BASIC have been developed by Microsoft
Company. This language is quite simple to
understand and has been adopted by most
of the microcomputers. It is suitable for both
mathematical and business problems. It is
compatible with MSDOS environment and it
has two basic files QBASIC.EXE and
QBASIC.HLP. We can edit, debug and execute
the program using these two files.
The advantages of QBASIC

 QBASIC is easy to learn and fun to practice. It


may be called a "People's language".
 It is available almost in every computer from
micro to mainframe. Therefore, a program
developed in a micro can run on bigger system
with minor modifications.
 It is suitable for mathematical and business
application.
 Program development cycle is quick, debugging
is simple, and
 Modification of program is quite easy.
QBASIC has the character set consisting of
the following elements:
 Alphabets: A, B, C,....Z

 Digits: 0, 1, 2........,9 and

 Special characters: + - * / ( ) . ,

$ ; ,: ,= ,> ,< , ^
 The symbol ^ (caret) is used to denote

exponentiation operator, the symbol *


(asterisk) is used to denote
multiplication and other symbols; have
their usual meanings.
Constants and Variables
 A quantity in a computer program which does not
change its value during the execution of the program is
called a constant and the quantity which may change
its values during the execution of the program is called
variable. QBASIC allows the following constants:
1. Numeric constant
 Numeric constant is one that is formed by a sequence

of digits 0, 1, 2,.....9 and may include a decimal point. A


numeric constant known as number may be integer or
a real number. 383, +57, 0, -6.2 and 6.15E4 are valid
numeric constants.
2. String constant
 A string constant consists of a sequence of characters

which must be enclosed by a quotation mark. Example


“A”, “hi”, “123”, “$” etc
Variable
 In QBASIC, variables are also of two
types:
 Numeric variable :Numeric variable can assume
numeric value and is represented by an alphabet or
an alphabet followed by another alphabet or digit.
For example A, C, A2, ABC, A6 etc, represent
numeric variables.
 String variable : A string variable is represented
by an alphabet followed by dollar ($) sign. It should
be kept in mind that while constructing the string
variable, dollar ($) should be the last character. For
example B1$, NAME$, BOOK1$, etc are valid string
variables.
Variables
 A variable is just like the variables used in -----CODE-----
math class. If I showed you x + 3 = 4, then CLS
you would know that x = 1 because x=4
y=2
subtracting 3 from each side leaves x by
PRINT 4 + 2
itself on the left while 1 is left on the right PRINT x + y
after solving 4 – 3. --------------
 The first one we will discuss is numeric -----OUTPUT-----
variables. Numeric variables are used just 6
like the variables in math, so you could say 6
something like ----------------
PRINT x + y
but instead of you solving for x and y, you
get to state what they are and the
interpreter does the rest for you. Let’s
make that example work like a real
program.
Variable
 A few more notes to remember about the naming of
variables. The name of variable must:
 Only contain numbers and/or letters, no symbols
 Not be a keyword.
Keywords are the words that already have a function
or use in the language. If you tried to use them, then
the interpreter would be confused and wouldn’t let
you run the program.
 Be less than 40 characters
 Some examples of good variables are:
answer
7eleven
seven11
variable6354

You might also like