Professional Documents
Culture Documents
Comprog Lecture 1
Comprog Lecture 1
Lecture 1
Vision
1. Begin
2. A= 2
3. B= 3
4. C= A+B
5. Print C
6. If A > B then
7. Print A * B
8. End if
9. If A< B then
10. Print A-B
11. End if
12. End
1-20
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
What is programming / programs?
• Key Words
• Programmer-Defined Identifiers
• Operators
• Punctuation
• Syntax
1-26
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Programming Language, Computer Program, and
Computer Programmer
• A programmer, computer programmer, developer, coder,
or software engineer is a person who writes computer software.
• The term computer programmer can refer to a specialist in one
area of computer programming or to a generalist who writes
code for many kinds of software.
1-29
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Programs and Programming Languages
1-30
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Notes:
• Closer to English but included simple mathematical
notation.
• Programs written in source code which must be
translated into machine language programs called
object code.
• The translation of source code to object code is
accomplished by a machine language system program
called a compiler.
1-35
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Review: Central Processing Unit (CPU)
CPU – Hardware component that
runs programs
Includes
• Control Unit
• Retrieves and decodes program
instructions
• Coordinates computer operations
• Arithmetic & Logic Unit (ALU)
• Performs mathematical operations
1-36
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Review: The CPU's Role in Running a
Program
Cycle through:
• Fetch: get the next program instruction
from main memory
• Decode: interpret the instruction and
generate a signal
• Execute: route the signal to the appropriate
component to perform an operation
1-37
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Review: Main Memory
• Holds both program instructions and data
1-38
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Review: Main Memory Organization
• Bit
• Smallest piece of memory
• Stands for binary digit
• Has values 0 (off) or 1 (on)
• Byte
• Is 8 consecutive bits 8 bits
• Has an address
• Word
• Usually 4 consecutive bytes 0 1 1 0 0 1 1 1
• NIBBLE
1 byte
1-39
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Review: Secondary Storage
1-41
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Review: Output Devices
1-42
Prepared by Prof. Edgar E. De Castro CEIT, Faculty
Friday 8:30 to 9:30
Lecture Quiz 1