Introduction To Computers and Programming
Introduction To Computers and Programming
Programming
Why Program?
Why Program?
Computer – programmable machine designed
to follow instructions
Program – instructions in computer memory to
make it do something
Programmer – person who writes instructions
(programs) to make computer perform a task
Figure 1-2
Central Processing Unit (CPU)
Comprised of:
Control Unit
Retrieves and decodes program instructions
Coordinates activities of all other parts of computer
Arithmetic & Logic Unit
Hardware optimized for high-speed numeric
calculation
Hardware designed for true/false, yes/no decisions
CPU Organization
Main Memory
• It is volatile. Main memory is erased when
program terminates or computer is turned off
• Also called Random Access Memory (RAM)
• Organized as follows:
– bit: smallest piece of memory. Has values 0 (off,
false) or 1 (on, true)
– byte: 8 consecutive bits. Bytes have addresses.
Main Memory
• Addresses – Each byte in memory is
identified by a unique number known as
an address.
Main Memory
1011010000000101
C++
BASIC Ruby
FORTRAN
Java
Visual Basic
COBOL
C#
JavaScript
C Python
From a High-Level Program to an
Executable File
a) Create file containing the program with a text
editor.
b) Run preprocessor to convert source file
directives to source code program statements.
c) Run compiler to convert source program into
machine instructions.
d) Run linker to connect hardware-specific code to
machine instructions, producing an executable
file.
• Steps b–d are often performed by a single
command or button click.
• Errors detected at any step will prevent
execution of following steps.
From a High-Level Program to an
Executable File
Integrated Development
Environments (IDEs)
• An integrated development environment,
or IDE, combine all the tools needed to
write, compile, and debug a program into a
single software application.
• Examples are Microsoft Visual C++, Turbo
C++ Explorer, CodeWarrior, etc.
Integrated Development
Environments (IDEs)