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

Practical Programming -L01

The document provides an introduction to programming with C++, focusing on automated information processing, types of machines, and programming languages. It explains the evolution from fixed-program machines to programmable machines and outlines the structure of a programmable machine, including components like the CPU, memory, and input/output devices. Additionally, it discusses the different generations of programming languages and their characteristics.

Uploaded by

Jaafar Abbakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Practical Programming -L01

The document provides an introduction to programming with C++, focusing on automated information processing, types of machines, and programming languages. It explains the evolution from fixed-program machines to programmable machines and outlines the structure of a programmable machine, including components like the CPU, memory, and input/output devices. Additionally, it discusses the different generations of programming languages and their characteristics.

Uploaded by

Jaafar Abbakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

University of Juba

Programming with C++


Practical Training
Lecture 1: Introduction
Overview
• Automated Information Processing
• Types of Machines
• Programming Languages
• Structure of a Programmable Machine
1. Automated Information Processing
Introduction
• Technological Advancements: The cost of electronic
devices (e.g., mobile phones, computers, cameras,
sensors) has decreased, while their speed and
capabilities have increased.
• Data Explosion: These devices generate massive
amounts of data globally, exceeding the storage
capacity of all storage media combined.
• Need for Automation: Manual processing of this data is
no longer feasible. Automated information processing
is essential to handle the volume efficiently.
What is a Program?
• A program is a set of instructions that a machine can
understand and execute automatically.
• It takes inputs, applies operations, and produces
outputs.
• Inputs can be fixed (part of the machine's environment)
or modifiable (changeable by the user).
2. Types of Machines
Fixed-Program Machines
• Definition: The processing mechanism is hardwired
using mechanical, electrical, or optical connections.
• Modification: To change the program, physical
alterations to the machine are required.
• Examples:
• Traditional weaving looms (inputs: threads;
outputs: carpets).
• Elevators and automatic gates (fixed states and
operations).
Programmable Machines
• Emergence: As the need for versatility grew, machines
evolved to allow external program encoding.
• Key Feature: Programs can be easily changed without
modifying the machine's hardware.
• Programming Languages: Developed to write programs
that machines can execute.
• Evolution: Programming languages have become more
human-readable and less hardware-dependent.
3. Programming Languages
a. Low-Level Languages
• Machine Language:
• Directly understood by the computer.
• Consists of binary numbers (0s and 1s).
• Machine-specific and difficult to write.
• Assembly Language:
• Uses symbols instead of binary numbers.
• Easier to write but still machine-dependent.
• Requires an assembler to translate into machine
language.
b. High-level languages
• Features:
• Machine-independent.
• Easier to learn and write.
• Errors are easier to detect and correct.
• Translation:
• Compiler: Translates the entire program at once
(faster execution).
• Interpreter: Translates line-by-line during
execution (slower but easier for debugging).
c. Generations of Programming Languages
• First Generation: Assembly Language (machine-
specific, low-level).
• Second Generation: Procedural Languages (e.g., Pascal,
Fortran).
• Third Generation: Object-Oriented Programming (OOP)
(e.g., Java, C++).
• Fourth Generation: Declarative Languages (e.g., SQL
for databases).
• Fifth Generation: Artificial Intelligence Languages (e.g.,
Prolog, LISP).
4. Structure of a programmable machine
The general structure of a programmable machine
The general structure of a programmable machine
1. CPU (for processing),
2. Memory (for data storage),
3. Input/Output Devices (for interaction),
4. Buses (for communication),
5. Clock (for synchronization),
6. Software (for instructions), and
7. Power Supply (for energy).

This structure is universal across all programmable machines, from


simple microcontrollers to complex computers. Understanding these
components is essential for designing, programming, and
troubleshooting such devices.
1. Central Processing Unit (CPU)
• Role: The "brain" of the computer; performs most computations.
• Instruction Cycle:
• Fetch: Retrieve instructions from memory.
• Decode: Interpret the instructions.
• Execute: Perform the operation.
• Write: Store the result back in memory.
Instruction cycle Example:
Say you're executing an instruction ADD now.
The stages involved in the cycle are as follows:
Step 1: Get the first no. from the given address , say a.
Step 2: Get the second no. from the given address, say b.
Step 3: Decode the instruction using the instruction decoder.
Step 4: DO a + b.
Step 5: Write the answer of a + b in the given address.
Here,
steps 1,2 are part of the fetch cycle.
step 3 is decode
step 4 is execution
step 5 is write
b. CPU Components
• ALU (Arithmetic Logic Unit): Performs arithmetic and
logical operations.
• Registers: Fast storage for temporary data.
• Control Unit (CU): Coordinates CPU activities.
c. CPU Processing Power

• 32-bit vs 64-bit: 64-bit CPUs


handle more data and larger
memory than 32-bit CPUs.
• Multi-core Processors:
Enable parallel processing
for faster task execution.
d. Memory
• Primary Memory:
• RAM (Random Access Memory): Volatile; stores
data temporarily.
• ROM (Read Only Memory): Non-volatile; stores
permanent data (e.g., BIOS).
d. Memory
• Secondary Memory:
• External storage (e.g., hard drives, SSDs) for
large, permanent data storage.
e. Input Devices
• Allow users to input data.
f. Output Devices
• Display or print information.
g. Buses
• Role: Communication pathways that connect the CPU, memory, and
input/output devices.

• Types:
• Data Bus: Transfers data between components.
• Address Bus: Specifies memory locations for data transfer.
• Control Bus: Carries control signals to coordinate operations.
h. Clock
• Role: Synchronizes the operations of the CPU and other
components.
• Clock Speed: Measured in Hertz (Hz), determines how
many instructions the CPU can execute per second.
i. Software (Programs)
• Role: Provides the instructions that the machine executes.
• Types:
• System Software: Manages hardware and provides a
platform for applications.

• Application Software: Performs specific tasks for the


user.
j. Power Supply
•Role: Provides the necessary electrical power to run the
machine.
•Importance: Ensures stable and reliable operation of all
components.
Activities
Activity 1: Compare Fixed-Program vs. Programmable Machines
• Examples:
• Washing machine (fixed) vs. Smartphone
(programmable).
• Calculator (fixed) vs. Computer (programmable).

Activity 2: Real-World Applications of Programming


• Examples:
• Banking systems (ATMs, online banking).
• Social media platforms (Facebook, Instagram).
• Autonomous vehicles (Tesla, self-driving cars).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy