Principles of Programming - NI July 2005 1 Chapter 1: Introduction In this chapter you will learn about: Overview of PC components The different types.

Slides:



Advertisements
Similar presentations
CS101: COMPUTER PROGRAMMING Lecture 1: Introduction to Computer and Programming.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
© Paradigm Publishing, Inc. 2-1 Chapter 2 Input and Processing Chapter 2 Input and Processing.
Using Computers CS French Chapter 1.
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Introduction to Computers
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Introduction to computer: storing instructions and information.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
CS102 Introduction to Computer Programming
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Introduction to Computers and Python. What is a Computer? Computer- a device capable of performing computations and making logical decisions at speeds.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Lesson 3 — How a Computer Processes Data
Chapter 3 Computer Hard ware
INTRODUCTION TO COMPUTER PROGRAMMING itc-314 LECTURE 01.
Chapter 1 Engineering Problem Solving 1. Hardware and Software 2 A computer is a machine designed to perform operations specified with a set of instructions.
Topics Introduction Hardware and Software How Computers Store Data
© Paradigm Publishing Inc. 2-1 Chapter 2 Input and Processing.
INTRODUCTION TO COMPUTING
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
CISC105 General Computer Science Class 1 – 6/5/2006.
Introduction to Computers
Computer Components Checklist There are many parts that work together to make a computer work.
© Paradigm Publishing Inc. 2-1 Chapter 2 Input and Processing.
Intro to Computers Computer Apps 1.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
CSEB114: Principle of Programming Chapter 1: Introduction to Computer and Programming.
Lesson 3 — How a Computer Processes Data Unit 1 — Computer Basics.
Intro to Computers Computer Applications. What is a Computer? Initially the term computer referred to an individual whose job it was to perform mathematical.
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Click once to reveal the definition. Think of the answer. Then click to see if you were correct. HARDWARE Physical parts of the computer.
CHAPTER 1: Introduction to Computers and Programming CSEB113 PRINCIPLES of PROGRAMMING CSEB134 PROGRAMMING I by Badariah Solemon 1BS (May 2012)
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
HOW A COMPUTER PROCESSES DATA. What is hardware? Hardware is the electric, electronic and mechanical equipment that makes up a computer What is software?
 Getting ready to code Lecture 1 Match 4, Course syllabus 
Chapter 4 Software. Introduction Program: is a set of sequence instructions that tell the computer what to do. Software: is a collection of programs,
Introduction To Computers
Chapter 1 An Overview of Computers and Programming Languages.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
INTRODUCTION TO COMPUTERS. A computer system is an electronic device used to input data, process data, store data for later use and produce output in.
Part 3 Ms. T. N. Jones1. Vocabulary 1. A design for health, safety, and comfort 2. A tool used to put data into a computer, such as a keyboard, mouse,
Computer Architecture and Number Systems
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
Introduction to Programming
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
CHAPTER 1: Introduction to Computers and Programming
C++ Programming: From Problem Analysis to Program Design
Computers: Hardware and Software
Topics Introduction Hardware and Software How Computers Store Data
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Presentation transcript:

Principles of Programming - NI July Chapter 1: Introduction In this chapter you will learn about: Overview of PC components The different types of language Natural Language Formal Language Functional / Imperative Language Programming Languages C as an imperative language C program at a glance

Principles of Programming - NI July Computer Hardware Components Components of a PC

Chapter 2 SAK3002 – Information Technology and Its Application What is computer hardware? Computer devices in physical form Comprised of 4 components: Input devices Central Processing Unit (CPU) Output devices Memory Introduction

Chapter 2 SAK3002 – Information Technology and Its Application Processor Control Unit Arithmetic Logic Unit (ALU) Input Devices Storage Devices Output Devices Memory DataInformation Instructions Data Information Control Unit Introduction (cont’d)

Chapter 2 SAK3002 – Information Technology and Its Application What is input?  Input device is any hardware component that allows users to enter data and instructions  Data or instructions entered into memory of computer Input Device

Chapter 2 SAK3002 – Information Technology and Its Application Input Device (cont’d) Two types of input:  Unprocessed text, numbers, images, audio, and video  Instructions  Programs  Commands  User responses  Data

Chapter 2 SAK3002 – Information Technology and Its Application Input Device (cont’d) Keyboard allows the computer user to enter Words Numbers Punctuation symbols and special function commands into the computer’s memory

Chapter 2 SAK3002 – Information Technology and Its Application Output Device What is output?  Data that has been processed into a useful form,  Output device is any hardware component that can convey information to user

Chapter 2 SAK3002 – Information Technology and Its Application Display device  Output device that visually conveys information  Information on display device sometimes called soft copy  Monitor houses display device as separate peripheral Output Devices (cont’d)

Chapter 2 SAK3002 – Information Technology and Its Application LCD monitor  Uses liquid crystal display  Have a small footprint  Mobile devices that contain LCD displays include  Notebook computer, Tablet PC, PDA, and Smart Phone Output Devices (cont’d)  Display device

Principles of Programming - NI July Input / Output Devices Input Devices Accepts information from the user and transforms it to digital codes that the computer can process Example: keyboard, mouse, scanner Output Devices An interface by which the computer conveys the output to the user Example: monitor, printer

Principles of Programming - NI July Main Memory A semiconductor device which stores the information necessary for a program to run. 2 types ROM (Read Only Memory) Contains information that is necessary for the computer to boot up The information stays there permanently even when the computer is turned off. RAM (Random Access Memory) Contains instruction or data needed for a program to run Got erased when the computer is turned off.

Chapter 2 SAK3002 – Information Technology and Its ApplicationProcessor Control Unit Arithmetic Logic Unit (ALU) What is the central processing unit (CPU)?  Interprets and carries out basic instructions that operate a computer Control Unit  Control unit directs and coordinates operations in computer  Arithmetic logic unit (ALU) performs arithmetic, comparison, and logical operations  Also called the processor CPU

Chapter 2 SAK3002 – Information Technology and Its Application Stores location from where instruction was fetched Stores instruction while it is being decoded Register Stores data while ALU computes it Stores results of calculation  Temporary high-speed storage area that holds data and instructions CPU (cont’d)

Principles of Programming - NI July Central Processing Unit (CPU) Does most of the work in executing a program The CPU inside a PC is usually the microprocessor 3 main parts: Control Unit Fetch instructions from main memory and put them in the instruction register ALU (Arithmetic Logic Unit) Execute arithmetic operations Registers Temporarily store instructions or data fetched from memory

Principles of Programming - NI July Storage Devices A magnetic device used to store a large amount of information. Store the software components or data needed for the computer to execute its tasks. Could be “read only” or “writable”. Example: Hard drive, CD ROM, floppy disks

Principles of Programming - NI July Network Devices Connect a computer to the other computers. Enable the users to access data or execute programs remotely. Example: modem, Ethernet card

Principles of Programming - NI July Natural language Our everyday-language; spoken and written Not 100% needed to understand: “Do you want to buy this computer ?” remains comprehensible

Principles of Programming - NI July Semantics and Syntax Semantics – the meaning of the language within a given context Syntax - Syntax are the rules to join words together in forming a correct expression or phrase. In natural languages it is often possible to assemble a sentence in more than one correct ways.

Principles of Programming - NI July Formal Language Language with limited, defined, words Each concatenation of words ('phrase') has a single, clearly defined meaning no (miss-)interpretation possible Sometimes called “Context Free Language” To 'talk' to a computer; to instruct a computer; our commands must be 100% clear and correct. Often there is only a single, correct syntax.

Principles of Programming - NI July Functional / Imperative Language Functional Language: Tell what to do, but not how: sum [1...10] Imperative Language: Tell what to do, but mainly how: “Take number 1 and add the next number to it; then add the next number to the sum; and so on; until you have reached 10 as number to be added. Then print the sum of all numbers”

Principles of Programming - NI July What is Programming? Programming is instructing a computer to do something for you with the help of a programming language The two roles of a programming language: Technical: It instructs the computer to perform tasks. Conceptual: It is a framework within which we organize our ideas about things and processes. In programming, we deal with two kind of things: Data - representing 'objects' we want to manipulate Procedures -'descriptions' or 'rules' that define how to manipulate data.

Principles of Programming - NI July Programming Language Formal Language used to communicate to a computer. A programming language contains instructions for the computer to perform a specific action or a specific task: 'Calculate the sum of the numbers from 1 to 10‘ 'Print “I like programming”‘ 'Output the current time'

Principles of Programming - NI July Programming Language Can be classified into as a special-purpose and general-purpose programming languages. Special-purpose : is design for a particular type of application Structured Query Language (SQL) General-purpose : can be used to obtain solutions for many types of problems Machine Languages Assembly Languages High-Level Languages

Principles of Programming - NI July Machine Language The only language that the processor actually 'understands‘ Consists of binary codes: 0 and 1 Example: Each of the lines above corresponds to a specific task to be done by the processor. Programming in machine code is difficult and slow since it is difficult to memorize all the instructions. Mistakes can happen very easily. Processor and Architecture dependent

Principles of Programming - NI July Assembly Language Enables machine code to be represented in words and numbers. Example of a program in assembler language: LOAD A, 9999 LOAD B, 8282 SUB B MOV C, A LOAD C, #0002 DIV A, C STORE A, 7002 Easier to understand and memorize (called Mnemonics), compared to machine code but still quite difficult to use. Processor and Architecture dependent

Principles of Programming - NI July High-Level Language Use more English words. They try to resemble English sentences. Therefore, it is easier to program in these languages. The programming structure is problem oriented - does not need to know how the computer actually executes the instructions. Processor independent - the same code can be run on different processors. Examples: Basic, Fortran, Pascal, Cobol, C, C++, Java A high level language needs to be analyzed by the compiler and then compiled into machine code so that it can be executed by the processor.

Principles of Programming - NI July C Programming Language Why 'C' ? Because based on 'B'; developed at Bell Laboratories Developed by Dennis Ritchie at Bell Laboratories in the 1960s In cooperation with Ken Thomson it was used for Unix systems The C Language was only vaguely defined, not standardized, so that almost everyone had his own perception of it, to such an extend that an urgent need for a standard code was creeping up

Principles of Programming - NI July C Programming Language cont… In 1983, the American National Standards Institute (ANSI) set up X3J11, a Technical Committee to draft a proposal for the ANSI standard, which was approved in 1989 and referred to as the ANSI/ISO 9899 : 1990 or simply the ANSI C, which is now the global standard for C. This standard was updated in 1999; but there is no compiler yet

Principles of Programming - NI July C – An Imperative Language C is a highly imperative language We must tell it exactly how to do what; the means and functions to use; which libraries to use; when to add a new line; when an instruction is finished; in short: everything and anything… Hint: Observe the syntax in the next slide

Principles of Programming - NI July A Simple Program in C #include main() { printf("I like programming in C.\n"); }

Principles of Programming - NI July A Simple Program in C - explanation #include main() { printf("I like programming in C.\n"); } standard Library, input-output, header-file Begin of program End of statement End of Segment Start of Segment Function for printing text Insert a new line

Principles of Programming - NI July C Output I like programming in C.

Principles of Programming - NI July Summary We have looked at some underlying hardware We have seen some different types of languages; the relevance of semantics and syntax. We have observed the detail necessary in an imperative language to instruct a computer properly. Finally, we examined the syntax to print a line of text to the screen of our computer.