ENGR2216 FORTRAN PROGRAMMING FOR ENGINEERS. Chapter 1 The computer CPU MEMORY INPUT/OUTPUT DEVICES DATA REPRESENTATION BINARY SYSTEM OCTAL & HEXADECIMAL.

Slides:



Advertisements
Similar presentations
Computer Hardware.
Advertisements

 The central processing unit (CPU) interprets and executes instructions.  The “brains” of the computer.  The speed of the processor is how fast it.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
2 pt 3 pt 4 pt 5pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2pt 3 pt 4pt 5 pt 1pt 2pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4pt 5 pt 1pt Category1 Computers Category2 CPU.
Main Memory Lecture 2 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
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.
CS102 Introduction to Computer 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.
Today’s Topics  Chapter 6: System Unit  Chapter 7: Input/Output and Storage.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
Computer Hardware and Software Jinchang Wang. Hardware vs. Software Hardware is something tangible. Computer hardware includes electronic circuitry and.
CSCI 125 & 161 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk.
Topics Introduction Hardware and Software How Computers Store Data
Georgia Institute of Technology Introduction to Programming Part 2 Barb Ericson Georgia Institute of Technology May 2006.
INTRODUCTION TO COMPUTERS The personal computer was far from reality in Computer users were limited to specially trained operators and engineers.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
MAC OS – Unit A Page: 10-11, Investigating Data Processing Understanding Memory.
Lesson 1b: Computer Systems and Program Development CPS118.
Introduction to Computers
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
Computer Basics By: Nicole Hayes. Purposes of Computers Business – Track inventory. – Calculate payroll. – Maintain databases. Personal – Surf the web.
Slide 1 Wednesday, October 07, 2015 Low Level Machine.
Course ILT Basics of information technology Unit objectives Define “information technology” (IT), distinguish between hardware and software, and identify.
Computers Are Your Future Eleventh Edition Chapter 2: Inside the System Unit Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall1.
1Copyright © Prentice Hall 2000 The Central Processing Unit Chapter 3 What Goes on Inside the Computer.
GCSE Information Technology Computer Systems 2 Hardware is the name that is given to any part of a computer that you can actually touch. An individual.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
School of Computer Science & Information Technology G6DICP Introduction to Computer Programming Milena Radenkovic.
Intro to Computers Computer Applications. What is a Computer? Initially the term computer referred to an individual whose job it was to perform mathematical.
Tolo-e-aftab higher education 1 th semester Bcs 1/2/1392 MINISTRY OF HIGHER EDUCATION.
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
The Computer System CS 103: Computers and Application Software.
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,
Chapter Two Hardware Basics: Inside the Box ©1999 Addison Wesley Longman2.2 Chapter Outline What Computers Do A Bit About Bits The Computer’s Core: CPU.
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software.
COMPUTER SYSTEM A computer system is define as combination of components designed to process data and store files. A computer system consists of four.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
CHAPTER 1 COMPUTER SCIENCE II. HISTORY OF COMPUTERS (1.1) Eniac- one of the worlds first computers Used more electricity than an entire city block of.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1: Introduction to Computers and Programming
Computer Architecture and Number Systems
Computer Science II Chapter 1.
Chapter 1: An Overview of Computers and Programming Languages
Introduction to Programming Part 2
Topics Introduction Hardware and Software How Computers Store Data
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Introduction to Programming
Computer System and Programming
The Central Processing Unit
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Introduction to Computers
Introduction to Computers
Topics Introduction Hardware and Software How Computers Store Data
Introduction to Programming Part 2
Information Technology Department
Hardware Information Created by Nasih.
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

ENGR2216 FORTRAN PROGRAMMING FOR ENGINEERS

Chapter 1 The computer CPU MEMORY INPUT/OUTPUT DEVICES DATA REPRESENTATION BINARY SYSTEM OCTAL & HEXADECIMAL DATA TYPES HISTORY OF FORTRAN EVOLUTION OF FORTRAN

Computers: are they important? Solving problems in any field Solving problems in any field Can you imagine a computer without software (programmes)? Can you imagine a computer without software (programmes)? Computer’s success is tied to programming Computer’s success is tied to programming

Where do we find computers? In a grocery store: scanners checking prices ATM (Automatic Teller Machines) Mobiles Microwave oven Cars Do you believe that the first electronic computer was invented about 60 years ago?

Basic Definitions A computer: A computer: is a special type of machine that stores information and can perform mathematical calculations on that information at speeds much faster than human beings can think. is a special type of machine that stores information and can perform mathematical calculations on that information at speeds much faster than human beings can think. A program: A program: tells the computer what sequence of calculations are required and on which information to perform the calculations. tells the computer what sequence of calculations are required and on which information to perform the calculations.

Examples of Programmes A computer at the bank stores customers’ information. Another programme can check each customer’s account daily. Once it goes below 100 Rials, the customer gets charged 1 Rial. Another programme can monitor the customers’ account, and send an sms message to the customers informing them that it’s time to take out their Zakat. Another program: when your phone’s battery becomes low, it gives you a warning: ”low battery”.

Computers vs. Human Are computers smarter than human? No, they only process programmes faster. They follow the instructions given in a programme. They can’t think on their own. They must be told what to do and when to do it A clever programme means a clever programmer

CPU = computer’s heart CPU = Control + ALU + memory Control: controls all PC parts ALU: performs calculations Memory: temporary storage of results during calculations Control: Interpret instructions Fetch data from input Send data from memory to output devices or main memory E.g. multiply 2 × 3 The computer

Main memory (e.g. RAM) Primary Volatile Semiconductor chip Very fast Fetch time  60 ns Expensive Store currently used programme Secondary memory (e.g. HDD) Non-volatile … explain! Higher capacity (80GB vs. 1GB) Slower Cheaper

The computer Input devices Purpose: enter data/information Examples: Keyboard Mouse Scanner Camera microphone Output devices Purpose: display results Examples: Monitors/ LCDs Printers Plotters speakers

The binary number system (725) 10 = 7 × × × 10 0 Used by human (101) 2 = 1 × × × 2 0 Used by computers Examples: Find the following: (111) 2 = (……) 10 (011) 2 = (……) 10 ( ) 2 = (……) 10 Byte = 8 bits How many possible values can we make with a 3-bit binary number? Hint: (000) to (111) HOW TO CONVERT FROM BASE 10 TO BASE 2? The 2 n rule.

Data representation in a computer What is a computer memory composed of ? Millions of ON/OFF switches How does a PC store data in memory? A switch is either ON (1) or OFF (0) A single switch can represent only 1 or 0. What does bit mean? BIT stands for Binary Digit A bit is either 1 or 0. 1 Byte = 8 bits representing a binary number E.g. memory of 256 MB (megabytes) = 256 million bytes E.g. hard disk drive with storage of 40 gigabytes = 40 billion bytes 1 word = 2, 4, (or more) consecutive bytes = 32, 64, bits How many possible values can we make with 1 byte? 2 8 = 256 possible values (-128 to 127)

Binary (2), Octal (8) and Hexadecimal (16) HexadecimalOctalBinaryDecimal A B C D E F

Types of Data stored in memory Each type needs a different amount of memory Character Data: UPPER CASE LETTERS (A-Z) = 26 Lower case letters (a – z) = 26 Digits (0 – 9) = 10 Symbols: “, ( ) [ ] ! # $ % ^ & *. Special letters or symbols (e.g. é ) Total number < 256  1 byte per character 1,000 characters need 1,000 bytes For non-English languages, more characters are used) Task: read text book for ASCII coding and EBCDIC coding Integer Data Real Data (floating point)

Types of Data stored in memory Each type needs a different amount of memory Character Data Integer Data: -ve integers, +ve integers, and zero Needs 1, 2, 4, or 8 bytes (differs from one computer type to another) In any computer that uses n-bit integer: Smallest integer =  2 n  1 Largest integer = 2 n  1 – 1(why  1?) What happens if a larger number is used? Task: read text book Error: Overflow condition Real Data (floating point)

Types of Data stored in memory Each type needs a different amount of memory Character Data Integer Data Real Data (floating point): Used for fractional numbers (e.g. 0.25) Used for very large or very small integers Value = mantissa × 2 exponent E.g. speed of light in decimal system = × 10 8 m/s Computers use base 2 system, with 32 bits (4 bytes) of computer memory: 24 bits for mantissa 8 bits for exponent Task: read text book Precision Range Round-off error

Computer Languages Machine language A program is a list of operations to be executed by a computer: E.g. load, store, add, subtract, etc. Each operation has a binary pattern (e.g. add = 1011) called op code The data associated with the op code are called operands A set of op codes is called machine language E.g. add 3, store A Machine language is very hard for human High level languages: Easy to write/understand List of instructions Convert to machine language using compilers and linkers Examples of high level programming languages: Basic C++ COBOL Fortran Java

FORTRAN Language Grandfather of all scientific computer languages FORmula TRANslation Translate formula into a computer code First FORTRAN: 1954 – 1957 By IBM for 704 computers

FORTRAN Language Grandfather of all scientific computer languages FORmula TRANslation Translate formula into a computer code First FORTRAN: 1954 By IBM for 704 computers Integers and real data types only No subroutines FORTRAN II: 1958 FORTRAN IV: 1962 (stayed for 15 Years) FORTRAN IV: 1966 (adopted as ANSI standard, and called FORTRAN 66 FORTRAN 77: 1977 (introduced IF statements, and simplified using characters) Fortran 90: 1992 Fortran 95: 1996 Text book covers both 90/95 Task: Read sections 1.4, and 1.5 of the text book