Lecture1 Introduction To Computers And Programming Language

  • Uploaded by: ryan ong
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Lecture1 Introduction To Computers And Programming Language as PDF for free.

More details

  • Words: 1,495
  • Pages: 46
BITG 1113: Introduction To Computers And Programming Language

LECTURE 1 LECTURE 1

1

Objectives In this chapter, you will: • Learn about different types of computers • Explore the hardware and software components of a computer system • Learn about the language of a computer • Learn about the evolution of programming languages • Examine high-level programming languages LECTURE 1

2

Objectives (cont.) • • • •

Discover what a compiler is and what it does Examine a C++ program Explore how a C++ program is processed Become aware of Standard C++ and ANSI/ISO Standard C++

LECTURE 1

3

Why Program? • Computer – programmable machine designed to follow instructions • Program – instructions in computer memory to make it do something • Programmer – person who writes instructions (programs) to make computer perform a task • SO, without programmers, no programs; without programs, a computer cannot do anything LECTURE 1

4

Categories of Computers • Mainframe computers • Midsize computers • Micro computers (personal computers)

LECTURE 1

5

Computer Components Computer is an electronic device, with two major components. Computer Hardware

Software

LECTURE 1

6

Main Hardware Component Categories: 1. 2. 3. 4. 5.

Central Processing Unit (CPU) Main Memory Secondary Memory / Storage Input Devices Output Devices

LECTURE 1

7

Main Hardware Component Categories

LECTURE 1

8

Central Processing Unit (CPU) Comprised of: – Control Unit • Retrieves and decodes program instructions • Coordinates activities of all other parts of computer

– Arithmetic & Logic Unit • Hardware optimized for high-speed numeric calculation • Hardware designed for true/false, yes/no decisions

LECTURE 1

9

CPU Organization

LECTURE 1

10

Main Memory • It is volatile. Main memory is erased when program terminates or computer is turned off • Also called Random Access Memory (RAM) • Organized as follows: – bit: smallest piece of memory. Has values 0 (off, false) or 1 (on, true) – byte: 8 consecutive bits. Bytes have addresses.

LECTURE 1

11

Main Memory • Addresses – Each byte in memory is identified by a unique number known as an address.

The number 149 is stored in the byte with the address 16, and the number 72 is stored at address 23. LECTURE 1

12

Main Memory

Main memory with some data

LECTURE 1

13

Secondary Storage • Non-volatile: data retained when program is not running or computer is turned off • Comes in a variety of media: – magnetic: floppy disk, zip disk, hard drive – optical: CD-ROM – Flash drives, connected to the USB port

LECTURE 1

14

Input Devices • Devices that send information to the computer from outside • Many devices can provide input: – Keyboard, mouse, scanner, digital camera, microphone – Disk drives and CD-ROM (Secondary storage)

LECTURE 1

15

Output Devices • Output is information sent from a computer program to the outside world. • The output is sent to an output device • Many devices can be used for output: – Computer monitor and printer – Floppy, zip disk drives, writable CD drives (Secondary storage)

LECTURE 1

16

Computer Software •Software: programs that do specific tasks. • Software is divided into 2 categories Software

System Software

Application Software

LECTURE 1

17

System Software • Related software that manages the system’s resources and control the operations of the hardware. • Normally supplied by the manufacturer of the computer. • Consists of utility programs and operating aids that facilitate the use and performance of the computer. • System programs take control of the computer, such as an operating system. • Operating system are programs that manage the computer hardware and the programs that run on them. Examples: Windows, UNIX, Linux. LECTURE 1

18

Application Software • Programs that provide services to the user. • Designed to perform a specific task (such as course registration or banking) OR a generalpurpose task (such as word processing, eg. Ms Word). • May be acquired by purchasing off-the-shelf or by designing for own purpose (custome made). • Off-the-shelf : prewritten and ready to use. • Custom made : written by in-house, consulting firm or software house. LECTURE 1

19

Where are the application and system software?

LECTURE 1

20

Computing Environment Personal Computing Time-Sharing Client / Server Computing Internet Computing LECTURE 1

21

Personal computing environment Picture 2

LECTURE 1

22

Time-sharing environment

LECTURE 1

23

The client/server environment Picture 2

LECTURE 1

24

The Language of a Computer • Digital signals are sequences of 0s and 1s • Machine language: language of a computer • Binary digit (bit): – The digit 0 or 1

• Binary code: – A sequence of 0s and 1s

• Byte: – A sequence of eight bits LECTURE 1

25

LECTURE 1

26

Coding Schemes • ASCII (American Standard Code for Information Interchange) – 128 characters – A is encoded as 1000001 (66th character) – 3 is encoded as 0110011

LECTURE 1

27

Coding Schemes (cont.) • EBCDIC – Used by IBM – 256 characters

• Unicode – 65536 characters – Two bytes are needed to store a character

LECTURE 1

28

History Of Computer Languages

Computer language evolution The only language understood by a computer is machine language LECTURE 1

29

History Of Computer Languages (cont.) 1.Machine Language • Computer only understand this language. • Series of 1’s and 0’s (binary numbers), such as 1011010000000101 • Difficult to write. • Low level language

LECTURE 1

30

History Of Computer Languages (cont.) • Early computers were programmed in machine language • To calculate wages = rates * hours in machine language: 100100 010001 100110 010010 100010 010011

//Load //Multiply //Store

LECTURE 1

31

History Of Computer Languages (cont.) 2. Symbolic/Assembly Language • Unique to particular computer. • Use mnemonics symbols. E.g. “MUL” –Multiply • Easier to understand.

LECTURE 1

32

History Of Computer Languages (cont.) • Using assembly language instructions, wages = rates • hours can be written as: LOAD rate MULT hour STOR wages

LECTURE 1

33

History Of Computer Languages (cont.) 3. High-Level Language • Portable to many different computers. • Instruction are coded • Eg. COBOL (Business), FORTRAN (Scientific), BASIC, Pascal, C, C++, C#, Java etc. • Programmers use this to write programs. • Compiler: translates a program written in a high-level language machine language • The equation wages = rate x hours can be written in C++ as: wages = rate * hours; LECTURE 1

34

History Of Computer Languages (cont.) 4. Natural Language • Like our natural language (such as English, French, or Chinese) • Its use is still quite limited.

LECTURE 1

35

Programs and Programming Languages • Types of languages: – High-level: closer to human language

– Low-level: used for communication with computer hardware directly. Often written in binary machine code (0’s/1’s) directly. LECTURE 1

36

Some Well-Known High-Level Programming Languages

LECTURE 1

37

Example of a C++ Program #include using namespace std; int main() { cout << "My first C++ program." << endl; cout << "The sum of 2 and 3 = " << 5 << endl; cout << "7 + 8 = " << 7 + 8 << endl; return 0; } Sample Run: My first C++ program. The sum of 2 and 3 = 5 7 + 8 = 15

LECTURE 1

38

Program Development • A computer understands a program only if the program is coded in its machine language. • Programmer have to write the program and turn it into an executable (machine language) code. • Programmer have to understand the problem -> break into actions-> execute by the computer. LECTURE 1

39

From a High-level Program to an Executable Code • • • •

• • •

There are 4 steps in the process : Create and edit file containing the program with a text editor. Run preprocessor to process the preprocessor directives (begin with #) Run compiler to: • Check that the program obeys the rules • Translate into machine language (object code) Run linker to connect hardware-specific code to machine instructions, producing an executable code. Steps b–d are often performed by a single command or button click. Errors detected at any step will prevent execution of following steps. LECTURE 1 40

From a High-level Program to an Executable Code Picture 2

Programmer

Code

Code

LECTURE 1

Executable Code

41

Program Development (cont.) Loader: – Loads executable code/program into main memory

Execution: – The last step is to execute the program

LECTURE 1

42

LECTURE 1

43

Integrated Development Environments (IDEs) • An integrated development environment, or IDE, combine all the tools needed to write, compile, and debug a program into a single software application. • Examples are Microsoft Visual C++, Borland C++ Builder, CodeWarrior, etc.

LECTURE 1

44

Integrated Development Environments (IDEs)

LECTURE 1

45

ANSI/ISO Standard C++ • C++ evolved from C • C++ designed by Bjarne Stroustrup at Bell Laboratories in early 1980s • C++ programs were not always portable from one compiler to another • In mid-1998, ANSI/ISO C++ language standards were approved LECTURE 1

46

Related Documents


More Documents from "SRINIVASA RAO GANTA"