Download presentation

Presentation is loading. Please wait.

Published byCandace Watson Modified over 2 years ago

1
ENGR2216 FORTRAN PROGRAMMING FOR ENGINEERS

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

3
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

4
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?

5
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.

6
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”.

7
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

8
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

9
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

10
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

11
The binary number system (725) 10 = 7 × 10 2 + 2 × 10 1 + 5 × 10 0 Used by human (101) 2 = 1 × 2 2 + 0 × 2 1 + 1 × 2 0 Used by computers Examples: Find the following: (111) 2 = (……) 10 (011) 2 = (……) 10 (00001110) 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.

12
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)

13
Binary (2), Octal (8) and Hexadecimal (16) HexadecimalOctalBinaryDecimal 0000000 1100011 2200102 3300113 4401004 5501015 6601106 7701117 81010008 91110019 A12101010 B13101111 C14110012 D15110113 E16111014 F17111115

14
Types of Data stored in memory Each type needs a different amount of memory 1. 1. 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 2. 2. Integer Data 3. 3. Real Data (floating point)

15
Types of Data stored in memory Each type needs a different amount of memory 1. 1. Character Data 2. 2. 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 3. 3. Real Data (floating point)

16
Types of Data stored in memory Each type needs a different amount of memory 1. 1. Character Data 2. 2. Integer Data 3. 3. 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 = 2.998 × 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

17
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,41011 0011 0100 store A 0101 0000 1010 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

18
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

19
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

Similar presentations

OK

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.

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.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on job skills Ppt on id ego superego definition Maths ppt on triangles for class 9 Ppt on test tube baby Ppt on division as equal sharing worksheets Ppt on data hiding in video using least bit technique Ppt on climate change in india Ppt online downloader without java Download ppt on water scarcity Ppt on zener diode operation