Top Banner
DAE 20102 COMPUTER PROGRAMMING CHAPTER 1: INTRODUCTION TO COMPUTER & ALGORITHM LECTURER: NOORDIANA KASSIM [email protected]
25

Chapter 1 introduction to computer and programming

Jan 20, 2015

Download

Education

Jay Leong

CHAPTER 1, COMPUTER PROGRAMMING (DAE 20102)
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 1 introduction to computer and programming

DAE 20102COMPUTER PROGRAMMING

CHAPTER 1:INTRODUCTION TO COMPUTER

& ALGORITHM

LECTURER:NOORDIANA KASSIM

[email protected]

Page 2: Chapter 1 introduction to computer and programming

OBJECTIVES

In this chapter you will learn:

Basic computer concepts Computer Software and hardware Computer classification The different types of programming

languages

Page 3: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

What is a computer? Electronic device that operates under the

control of instructions stored in memory units

Computer systems divided into two; hardware and software

Hardware: physical components of computer system

Software refers to a program or set of instructions that instructs a computer to perform some task.

Page 4: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Page 5: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Software can be divided into two major categories called system software and application software.

Systems software includes operating systems and various device drivers.

Application software are used to perform real-world tasks and solve specific problems.

A program is simply a set of instructions that tells a computer how to perform a particular task.

Programs are developed using programming languages.

A programming language provides a set of rules to develop a program. A person who writes a program using a programming language is called a programmer.

Page 6: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Computer Organization Input Unit Output Unit Memory Unit Arithmetic and Logic Unit Central Processing Unit Secondary Storage Unit

Page 7: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Input and Output Unit

The most common types of I/O in PCs are:

Monitor - The monitor is the primary device for displaying information from the computer.

Keyboard - The keyboard is the primary device for entering information into the computer.

Mouse - The mouse is the primary device for navigating and interacting with the computer

Page 8: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Memory Unit Memory - This is very fast storage used to hold data. It has to be

fast because it connects directly to the microprocessor. There are several specific types of memory in a computer:

Random-access memory (RAM) - Used to temporarily store information that the computer is currently working with

Read-only memory (ROM) - A permanent type of memory storage used by the computer for important data that does not change

Basic input/output system (BIOS) - A type of ROM that is used by the computer to establish basic communication when the computer is first turned on

Caching - The storing of frequently used data in extremely fast RAM that connects directly to the CPU

Virtual memory - Space on a hard disk used to temporarily store data and swap it in and out of RAM as needed

Page 9: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

ALU The arithmetic logic unit (ALU) is a

digital circuit that calculates an arithmetic operation (like an addition, subtraction, etc.) and logic operations (like an Exclusive Or) between two numbers

ALU is a fundamental building block of the central processing unit of a computer.

Page 10: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Central Processing Unit A microprocessor -- also known as a

CPU or central processing unit -- is a complete computation engine that is fabricated on a single chip.

Page 11: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Secondary Storage

Removable storage - Removable storage devices allow you to add new information to your computer very easily, as well as save information that you want to carry to a different location.

› Floppy disk - The most common form of removable storage, floppy disks are extremely inexpensive and easy to save information to.

› CD-ROM - CD-ROM (compact disc, read-only memory) is a popular form of distribution of commercial software. Many systems now offer CD-R (recordable) and CD-RW (rewritable), which can also record.

Page 12: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

› Flash memory - Based on a type of ROM called electrically erasable programmable read-only memory (EEPROM), Flash memory provides fast, permanent storage. CompactFlash, SmartMedia and PCMCIA cards are all types of Flash memory.

› DVD-ROM - DVD-ROM (digital versatile disc, read-only memory) is similar to CD-ROM but is capable of holding much more information.

Page 13: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Early Operating Systems Batch processing

› Do only one job or task at a time Operating systems

› Manage transitions between jobs› Increased throughput

Amount of work computers process Multitasking

› Computer resources are shared by many jobs or tasks

Timesharing› Computer runs a small portion of one user’s

job then moves on to service the next use

Page 14: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Personal Computing, Distributed Computing, and Client/Server Computing

Personal computers › Economical enough for individual

Distributed computing › Computing distributed over networks

Client/server computing› Sharing of information across computer

networks between file servers and clients (personal computers)

Page 15: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Programming Languages Machine Language

Assembly Language

High-Level Languages

Page 16: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

1. Machine languages Strings of numbers giving machine specific instructions

2. Assembly languages English-like abbreviations representing elementary

computer operations (translated via assemblers) Example:

LOAD BASEPAYADD OVERPAYSTORE GROSSPAY

Page 17: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

3. High-level languages Codes similar to everyday English Use mathematical notations (translated via

compilers) Example:

grossPay = basePay + overTimePay

Page 18: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Fortran, COBOL, Pascal and Ada Fortran

› developed by IBM Corporation in the 1950s› used for scientific and engineering applications

that require complex mathematical computations

COBOL› developed in 1959 by computer manufacturers,

the government and industrial computer users› used for commercial applications that require

precise and efficient manipulation of large amounts of data

Page 19: Chapter 1 introduction to computer and programming

Introduction To Computer & Programming

Pascal› Developed by Professor Niklaus Wirth in

1971› Designed for teaching structured

programming Ada

› Developed under the sponsorship of the U.S. Department of Defense (DOD) during the 1970s and early 1980s

› Able to perform multitasking

Page 20: Chapter 1 introduction to computer and programming

Structured Problem Solving

Flowchart › Graphical representation of an algorithm› Drawn using certain special-purpose symbols

connected by arrows called flow lines› Rectangle symbol (action symbol):

Indicates any type of action

› Oval symbol: Indicates the beginning or end of a program or a

section of code

Page 21: Chapter 1 introduction to computer and programming

Structured Problem Solving Flow chart components

Start/End

Process

Input/Output

ConditionStatement

Flow Lines

Connector

Page 22: Chapter 1 introduction to computer and programming

Structured Problem Solving

Pseudo code› Artificial, informal language that helps us

develop algorithms› Similar to everyday English› Not actually executed on computers › Helps us “think out” a program before

writing it Easy to convert into a corresponding C++

program Consists only of executable statements

Page 23: Chapter 1 introduction to computer and programming

Algorithm Example 1 /* This is a comment */ /* Name : Lab2.c */ /* Purpose : Prints C Program Example */ /* Author : Diana Kassim */

#include <stdio.h> int main(void)   { printf("This is my first programming !!!"); return 0;   }  

Page 24: Chapter 1 introduction to computer and programming

Programming Errors

Three Types› Syntax Errors

Errors in code construction› Runtime Errors

Detect operations impossible to carry out› Logic Errors

Program does not perform the way it intended it to

Page 25: Chapter 1 introduction to computer and programming

Marks > 85

Enter Marks

Start

Display “GAGAL”

Display “LULUS”

End