Sie sind auf Seite 1von 7

Outline

 Hardware and Software

 Programming

 Programming languages
60-140-30 LECTURE 1:  Algorithm and Flowchart
INTRODUCTION

Dr. Mina Maleki

Computers Hardware
3 4

 Computers are tools  Physical aspects of computers


 They do only what they are told to do.
 They can operate extremely fast, performing billions of
 Hardware Categories
operations per second.  Input device
 They can operate for extremely long periods of time
 Processing device
without getting tired or making mistakes.
 They can perform the same tasks repeatedly, also  Storage device
without getting tired or making mistakes.
 Output device
Hardware Categories Hardware Categories …
5 6

 Input device: To read user input data into a  Processing device: To process the raw data and
computer coordinate all the other hardware devices work together
 Keyboards  The processor is an integrated circuit that contains the CPU
 Pointing devices: Mouse, Pen input (Central Processing Unit)
 Audio input devices: Microphone  Two parts of the CPU
 Visual and Imaging devices: Webcam, Scanner  Control unit (traffic manager)
 Output device: To send data to another device or  To interpret software instructions and tells the other hardware
devices what to do
user  Fetch, decode, execute, store
 Display output: Monitor  Arithmetic logic unit - ALU (calculator)
 Sound output: Speaker, Headphone  To perform all arithmetic and logic operations such as additions,
 Hardcopy output: Printer multiplications, subtractions and division, and comparison

Hardware Categories … Software


7 8

 Storage device: To store data  Different kinds of programs used to operate


 Primary temporary storage: computers
 Can be accessed by computer’s CPU with
minimal delay
 Contains the instructions that the hardware
 Data is erased when the computer is shut
Examples of storage devices executes to perform a task
down  volatile memory  Without the aid of software, the computer
 Example: random access memory (RAM)
hardware is useless
 Secondary permanent storage:
 Cannot directly communicate with the CPU
 Software types:
 Persistent storage  Application
 Example: Read-only memory (ROM), Hard  System
disk, CD/DVD-ROM, Flash memory
Application Software System Software
9 10

 Software used to  Coordinates the interaction of all technology devices


 Solve specific information processing tasks along with the application software
 Payroll  Operating System (OS): A program that controls the
 Project
management entire operation of a computer system
 Word processing and many others  Handles all input and output (I/O) operations that are
 Perform specific personal tasks such as writing a memo, performed on a computer
creating a graph, or creating a slide presentation  manages the computer system’s resources
 Microsoft Word/Excel  Most famous OS families:
 Internet Explorer
 Windows
 Unix , Linux

 Mac

Programming
11

 Computers are tools


 They do only what they are told to do. Programming Languages
 Solve a problem using a computer  Express the
Machine Languages
solution in terms of the instructions of the particular
computer. Assembly Languages
 A program is a collection of detailed instructions Higher-level Languages
necessary to solve a specific problem.
 These instructions are written in certain programming
language
 The approach or method that is used to solve the
problem is known as an algorithm.
Programming Languages Machine Languages
13 14

 A set of basic instructions and data directly


 Machine Languages understandable/ executable by a computer's CPU.
 Assembly Languages  Each instruction performs a very specific task.
 Example: load, a jump, or an arithmetic operation on a unit
 Higher-level Languages of data in a memory.
 The instructions are represented in binary notation
(sequences of 0s and 1s).
 Because computer hardware relies on electric/electronic
circuits that have/can switch between 2 states
 bit (binary digit of 0 and 1)
 Byte: 8 bits (such as 10111001)

Machine Languages … Assembly Languages


15 16

 Example: Add two numbers, and if the preliminary  Human-readable notation for the machine language
result is less than 10, then add 10 to the result  Uses symbolic names for operations
1010 1111  Example: 1010 1111 load 15
1011 0111 1011 0111 load 7
0111 0111 ADD
0011 1010 0011 1010 CMP 10
0010 1100 0010 1100 JGE 12
0110 1010 0110 1010 ADD 10
… … 12 …
 Even into the 1990s, the majority of console video
 Every CPU model has its own machine code, or games were written in assembly language.
instruction set
Assembly Languages … High-level Languages
17 18

 Translation of assembly language into machine  Higher level of abstraction from machine language
 Codes similar to everyday English
language  assembler (a special computer program)
 Make complex programming simpler
 Disadvantages of the Low-level language:
 Translation of high level language into machine language 
 programmer must learn the instruction set of the compilers (a special computer program)
particular processor  A high level instruction (statement) is translated into many
 Program must be rewritten in order to run on a machine instructions  Portable
different processor type – program is not portable  Example: C/C++/C#, Pascal, Fortran, JAVA, …

High-level Languages … The C Programming Language


19 20

1010 1111 load 15 A high-level programming language


 Example 1011 0111 load 7

0111 ADD  Developed by Dennis Ritchie at AT&T Bell Laboratories in the


0011 1010 CMP 10 early 1970s
0010 1100 JGE 12
0110 1010 ADD 10  Growth of C tightly coupled with growth of Unix: Unix was written
DEFVAR a,b,c; … 12 … mostly in C
BEGIN
READ a  Many providers of C compilers for many different platforms =>
READ b need for standardization of the C language
READ c
c := a+b  1990: ANSI C (American National Standards Institute)
IF (c <10) THEN  1990: International Standard Organization: ISO/IEC 9899:1990
c:=c+10
PRINT c  1999: standard updated: C99, or ISO/IEC 9899:1999
END
Strength of C
21

 Building block for many other currently known languages.


 C++, Java, C# and Perl Algorithm
 Efficiency
 C language has variety of data types and powerful operators 
fast and easy to understand.
 Portability
 C programs written for one computer can easily run on another
computer without any change or by doing a little change.
 Standard library
 Several standard functions are available which can be used for
developing programs.
 Ability to extend itself
 Adding new functions to C library is easy.
 Support system programming

Algorithm Algorithm …
23 24

 A procedure/method for solving a problem in terms of:  Example: Write an algorithm to add two numbers
entered by user.
1. The actions to be executed
Start
2. The order in which these actions are to be executed
Read values num1 and num2.
 How?
Add num1 and num2 and assign the result to sum.
 Try to understand the question properly sum←num1+num2
 Think of and explore your idea Display sum
 Document a proper solution. Stop
Flowchart Raptor
25 26

 Represents an algorithm in Start  A free flowchart-based


graphical symbols /End programming environment
 A collection of connected  Developed by and for the US Air
graphic symbols Process Force Academy, Department of CS
 Each symbol represents a  To help students visualize their
specific type of instruction to be algorithms
Input /
executed. Output
 The connections between
symbols determine the order in
which instructions are executed. Decision
To be continued

Lecture 1: Summary
27

 Some Fundamentals
 Hardware and Software
 Programming languages

 Algorithm and flowchart

 Assigned Reading:
 Chapter 1 – Introducing C
 Assignment
 Deadlineof the first lab assignment is on Jan. 12
 Assignments should be submitted in Labs.

Das könnte Ihnen auch gefallen