chapter 1-introduction to computer programming

Upload: loo-fu-hong

Post on 06-Mar-2016

18 views

Category:

Documents


0 download

DESCRIPTION

g

TRANSCRIPT

PowerPoint Presentation

1.2 Hardware, Software, and FirmwareYAW- credit to HAA,RAK & AIH8Hardware: all of the tangible equipment involved in a computers operation. (e.g Processor, Hard disk, Keyboard, Printer) Software: set of instructions that can be read into computers memory and later execute on demand. (e.g.: Microsoft office)Firmware: hardware device that is programmed using software. (e.g. EEPROM)

SyllabusYAW- credit to HAA,RAK & AIH2Lesson OutcomesYAW- credit to HAA,RAK & AIH3Understanding the basic concept of computer programmingIdentify the elements of a typical C program development environmentTo become familiar with fundamental data typeYAW- credit to HAA,RAK & AIH5Three main elements of basic computer system:

CPU (central processing unit/microprocessor)MemoryInput/Output

Three main buses:Address busControl busData bus

1.1 Basic Computer ArchitectureBasic Computer ArchitectureYAW- credit to HAA,RAK & AIH6

Bus System- It is used to transfer information in the systemYAW- credit to HAA,RAK & AIH7

1)The heart of the computer2) does the actual -processingarithmetic and decision making controls the operation of the rest of the computerEnables a computer to store, at least temporarily, data and programs.

- data and instructions enter a computerlets you see what the computer has accomplishedBasic Computer ArchitectureProgramming languageYAW- credit to HAA,RAK & AIH9

YAW- credit to HAA,RAK & AIH10Machine Language

Built-in to the CPU Binary code

Alternative codes: Octal

Hexadecimal bits & bytes

Example:

0000000000010101000101100011010101110111

YAW- credit to HAA,RAK & AIH11Assembly Language

Symbolic/mnemonicscodes

Unstructured

Processor dependent Assembler translate tomachine language

Example:

CLR

MOV A,#2ADD A,#2MOV R0,AEND

YAW- credit to HAA,RAK & AIH12High Level Language

Use proper syntax Easy to understand Machine/Processor

Independent Compiler language

High Level Language Fortran (1950s)

Basic (1960s) Pascal (1960s) C (1970s)

MATLAB (1970s)

YAW- credit to HAA,RAK & AIH13C Programming Language

History

1972 by Dennis Ritchie Based on B/BCPL

OS language (UNIX) ANSI/ISO C (1989/99) Evolution

C++, C#, Ch Borland C/C++ Visual C/C++

C advantages Powerful, lean &

efficient language Less rigid structure Embedded ability Bit-manipulation Low high (mid) level

language

1.3 Compiling, Linking and Producing an Executable Program

YAW- credit to HAA,RAK & AIH14Executable file (FILE.EXE)Editor(create and modify code)Compiler(convert source code into m/c code)Memory (RAM or ROM)Source code file (FILE.C)Object code file (FILE.OBJ)Errors and/or warningsLibraries and other object codeCompiler & Linker

Compiler

Translate code to machine language Linker

Built executable program file

Most modern compiler has built-in linkercapability

YAW- credit to HAA,RAK & AIH15Errors in Programming

Compilation error

Syntax error

Easy to identify andcorrected

Logic error

Programmer error Not easy to identify

and correct

May cause run-timeerror

YAW- credit to HAA,RAK & AIH16Development Environment

What you needs?

A source code editor A compiler and linker An optional debugger

Integrated Development Environment - IDE

All-in-One application (programming) software

YAW- credit to HAA,RAK & AIH17Code::blocks Compiler

MinGW ANSI C/C++ (C99) compiler OSS Licensed IDE for developer Source editor

Compiler & Linker Debugger

YAW- credit to HAA,RAK & AIH18http://www.codeblocks.orgDEVCpp Compiler

MinGW ANSI C/C++ (C99) compiler OSS License IDE for developer Source editor

Compiler & Linker Debugger

YAW- credit to HAA,RAK & AIH19Borland C++ Compiler

Borland C++ (Turbo C/C++) compiler

C++ Builder: IDE for Windows applicationsdeveloper

Source Code editor Compiler & Linker Debugger

YAW- credit to HAA,RAK & AIH20Visual C++ Compiler

Built-in MS Window C++ compiler

MS Visual Studio: IDE for Windows applicationsdeveloper

Source Code editor Compiler & Linker Debugger

YAW- credit to HAA,RAK & AIH21END OF CHAPTER 1YAW- credit to HAA,RAK & AIH22Q& AOutcomesUnderstanding the basic concept of computer programmingIdentify the elements of a typical C program development environmentTo become familiar with fundamental data typeReflection

Programming Language

Low Level Language

High LevelLanguage

Machine Language

Assembly Language

0000000000010101000101100011010101110111

CLRADDSUBSFTDC

FortranScientific programmingCOBOLBusiness data processingCSystem programmingAdaReal-time distributed systemsBASICPrologLispC++C#