SlideShare a Scribd company logo
1 of 18
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Chapter 1: Introduction
Outline
Introduction
What Is a Computer?
Computer Hardware
Computer Software
Computer Programming Languages
Machine Code, Assembly Languages and High-Level Languages.
The History of C
Object-Oriented Programming in C++
Compilation-Based Execution of Programs
Executing Programs Using an Interpreter
A C/C++ Interpreter Ch
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Introduction
• We will learn the C programming language
– Learn structured programming and proper
programming techniques.
– Introduction to numerical computing in Ch.
– Introduction to MATLAB in comparison study with C.
• The prerequisite is trigonometry
– No prior programming experience is required.
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
What is a Computer?
• Computer
– A computer is a machine that manipulates data based on a list of
instructions called program.
– A computer consists of hardware and software.
• Computer Hardware
– Computer hardware is the physical part of a computer.
– A typical computer consists of central processing unit (CPU), main
memory and external memory , and input and output devices.
– A CPU consists of control unit (CU), arithmetic and logic unit
(ALU), and registers.
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Samples of Computer Hardware
A single board computer and a tiny computer.
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
The von Newmann Computer Architecture
Both programs and data are stored in the same memory
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Major Components of a Computer
1. Input devices
• Obtains information from input devices (keyboard, mouse)
2. Output devices
• Outputs information (to screen, printer, control other devices)
3. Main memory
• Installs programs and data for rapid access
4. CPU:
4.1 Arithmetic and logic unit (ALU)
• Performs arithmetic calculations and logic decisions
4.2 Control unit (CU)
• Supervises and coordinates activities of the computer
4.3 Registers
Fast memory
5. External memory
• Store programs and data permanently (hard disks, CDs, USB)
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Computer Software
Computer software refers to a collection of computer programs that can
be loaded into main memory and executed in the CPU of a computer.
Computer software can be classified as operating system and application
software.
An operating system is a software program for management and
coordination of activities and sharing the resources of a computer.
Application software refers to programs developed to assist users in
completing specific tasks.
A process: a running program.
Software is harder than hardware.
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Interaction of Users and Computer
Hardware through Software
Two interface methods:
(1) Command shell
(2) Graphical user interface (GUI)
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Graphical User Interface
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Command Shells and Their Inventors
• Bourne shell (sh) Stephen Bourne
• C shell (ch) Bill Joys
• Korn shell (ksh) David Korn
• BASH shell (sh, bash) Brian J. Fox
• Ch (C/C++) shell (ch) Harry H. Cheng
• MS-DOS shell (cmd, command) Tim Paterson
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Using commands pwd, cd, and ls to print the working
directory, change directory, and list files in the Ch
home directory.
C:/Ch> pwd
C:/Ch
C:/Ch> ls
bin/ demos/ docs/ include/ license/ README.TXT sbin/
config/ dl/ extern/ lib/ package/ release/ toolkit/
C:/Ch> cd docs
C:/Ch/docs>
C:/Ch/docs> ls
README.TXT chguide.pdf chinstall.pdf chref.pdf man/
Ch Command Shell
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Computer Programming Languages
Three types of programming languages
1. Machine code or machine languages
A sequence of 0’s and 1’s giving machine specific instructions
Example: 00011001
2. Assembly language
Using meaningful symbols to represent machine code.
Example: add hl,de
Assembler: Assembly code  machine code
Disassembler: machine code  assembly code
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Computer Programming Languages
3. High-level languages
Similar to everyday English and use mathematical notations
(processed by compilers or interpreters)
Example of a C statement:
a = a + 8;
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Comparison of High-Level Language with
Machine Code and Assembly Code
Memory address Machine code Assembly code
-------------------------------------------------------------------------------------
0X1EA1 000100010000100000000000 ld de,0x0008
0X1EA4 1100010000000000 ld hl,(sp+0)
0X1EA6 00011001 add hl,de
0X1EA7 1101010000000000 ld (sp+0),hl
The memory addresses, machine code, and assembly code
corresponding to a C statement a = a + 8 for the Rabbit
3000 8-bit microprocessor.
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
High-level Computer Languages
and Their Inventors
• FORTRAN John W. Backus, 1954
• BASIC George Kemeny and Tom Kurtz, 1964
• Pascal Nicolas Wirth
• C Dennis M. Ritchie
• C++ Bjarne Stroustrup
• Java James Gosling
• C# Anders Hejlsberg
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Ch versus Other Languages
Ch is a C/C++ interpreter. It is especially suitable
for learning computer programming in C and C++.
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Phases of Interpreter-Based Execution
of a Program
1. Edit
2. Execute
Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved.
C for Engineers and Scientists: An Interpretive Approach
Interpretive Execution
of a C Program
Executing a C program using an interpreter.

More Related Content

Similar to chap01_computer_programming.ppt

Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxNEHARAJPUT239591
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJmeharikiros2
 
ch01_an overview of computers and programming languages
ch01_an overview of computers and programming languagesch01_an overview of computers and programming languages
ch01_an overview of computers and programming languagesLiemLe21
 
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdfhanumanparsadhsr
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docMayurWagh46
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxCoolGamer16
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...bhargavi804095
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionAKR Education
 
Learn c programming language in 24 hours allfreebooks.tk
Learn c programming language in 24 hours   allfreebooks.tkLearn c programming language in 24 hours   allfreebooks.tk
Learn c programming language in 24 hours allfreebooks.tkragulasai
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...bhargavi804095
 
object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentalsChaithraCSHirematt
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++Ankur Pandey
 
Understanding C and its Applications.pdf
Understanding C and its Applications.pdfUnderstanding C and its Applications.pdf
Understanding C and its Applications.pdfAdeleHansley
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfAnassElHousni
 
Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Shujaat Abbas
 

Similar to chap01_computer_programming.ppt (20)

C programming day#1
C programming day#1C programming day#1
C programming day#1
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
 
ch01_an overview of computers and programming languages
ch01_an overview of computers and programming languagesch01_an overview of computers and programming languages
ch01_an overview of computers and programming languages
 
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
Learn c programming language in 24 hours allfreebooks.tk
Learn c programming language in 24 hours   allfreebooks.tkLearn c programming language in 24 hours   allfreebooks.tk
Learn c programming language in 24 hours allfreebooks.tk
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
 
computer programming C++
computer  programming C++computer  programming C++
computer programming C++
 
object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentals
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
 
Understanding C and its Applications.pdf
Understanding C and its Applications.pdfUnderstanding C and its Applications.pdf
Understanding C and its Applications.pdf
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
C++ programming example
C++ programming exampleC++ programming example
C++ programming example
 
Chap 1 c++
Chap 1 c++Chap 1 c++
Chap 1 c++
 
Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)
 

Recently uploaded

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 

Recently uploaded (20)

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 

chap01_computer_programming.ppt

  • 1. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Chapter 1: Introduction Outline Introduction What Is a Computer? Computer Hardware Computer Software Computer Programming Languages Machine Code, Assembly Languages and High-Level Languages. The History of C Object-Oriented Programming in C++ Compilation-Based Execution of Programs Executing Programs Using an Interpreter A C/C++ Interpreter Ch
  • 2. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Introduction • We will learn the C programming language – Learn structured programming and proper programming techniques. – Introduction to numerical computing in Ch. – Introduction to MATLAB in comparison study with C. • The prerequisite is trigonometry – No prior programming experience is required.
  • 3. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach What is a Computer? • Computer – A computer is a machine that manipulates data based on a list of instructions called program. – A computer consists of hardware and software. • Computer Hardware – Computer hardware is the physical part of a computer. – A typical computer consists of central processing unit (CPU), main memory and external memory , and input and output devices. – A CPU consists of control unit (CU), arithmetic and logic unit (ALU), and registers.
  • 4. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Samples of Computer Hardware A single board computer and a tiny computer.
  • 5. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach The von Newmann Computer Architecture Both programs and data are stored in the same memory
  • 6. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Major Components of a Computer 1. Input devices • Obtains information from input devices (keyboard, mouse) 2. Output devices • Outputs information (to screen, printer, control other devices) 3. Main memory • Installs programs and data for rapid access 4. CPU: 4.1 Arithmetic and logic unit (ALU) • Performs arithmetic calculations and logic decisions 4.2 Control unit (CU) • Supervises and coordinates activities of the computer 4.3 Registers Fast memory 5. External memory • Store programs and data permanently (hard disks, CDs, USB)
  • 7. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Computer Software Computer software refers to a collection of computer programs that can be loaded into main memory and executed in the CPU of a computer. Computer software can be classified as operating system and application software. An operating system is a software program for management and coordination of activities and sharing the resources of a computer. Application software refers to programs developed to assist users in completing specific tasks. A process: a running program. Software is harder than hardware.
  • 8. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Interaction of Users and Computer Hardware through Software Two interface methods: (1) Command shell (2) Graphical user interface (GUI)
  • 9. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Graphical User Interface
  • 10. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Command Shells and Their Inventors • Bourne shell (sh) Stephen Bourne • C shell (ch) Bill Joys • Korn shell (ksh) David Korn • BASH shell (sh, bash) Brian J. Fox • Ch (C/C++) shell (ch) Harry H. Cheng • MS-DOS shell (cmd, command) Tim Paterson
  • 11. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Using commands pwd, cd, and ls to print the working directory, change directory, and list files in the Ch home directory. C:/Ch> pwd C:/Ch C:/Ch> ls bin/ demos/ docs/ include/ license/ README.TXT sbin/ config/ dl/ extern/ lib/ package/ release/ toolkit/ C:/Ch> cd docs C:/Ch/docs> C:/Ch/docs> ls README.TXT chguide.pdf chinstall.pdf chref.pdf man/ Ch Command Shell
  • 12. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Computer Programming Languages Three types of programming languages 1. Machine code or machine languages A sequence of 0’s and 1’s giving machine specific instructions Example: 00011001 2. Assembly language Using meaningful symbols to represent machine code. Example: add hl,de Assembler: Assembly code  machine code Disassembler: machine code  assembly code
  • 13. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Computer Programming Languages 3. High-level languages Similar to everyday English and use mathematical notations (processed by compilers or interpreters) Example of a C statement: a = a + 8;
  • 14. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Comparison of High-Level Language with Machine Code and Assembly Code Memory address Machine code Assembly code ------------------------------------------------------------------------------------- 0X1EA1 000100010000100000000000 ld de,0x0008 0X1EA4 1100010000000000 ld hl,(sp+0) 0X1EA6 00011001 add hl,de 0X1EA7 1101010000000000 ld (sp+0),hl The memory addresses, machine code, and assembly code corresponding to a C statement a = a + 8 for the Rabbit 3000 8-bit microprocessor.
  • 15. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach High-level Computer Languages and Their Inventors • FORTRAN John W. Backus, 1954 • BASIC George Kemeny and Tom Kurtz, 1964 • Pascal Nicolas Wirth • C Dennis M. Ritchie • C++ Bjarne Stroustrup • Java James Gosling • C# Anders Hejlsberg
  • 16. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Ch versus Other Languages Ch is a C/C++ interpreter. It is especially suitable for learning computer programming in C and C++.
  • 17. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Phases of Interpreter-Based Execution of a Program 1. Edit 2. Execute
  • 18. Created by Harry H. Cheng,  2009 McGraw-Hill, Inc. All rights reserved. C for Engineers and Scientists: An Interpretive Approach Interpretive Execution of a C Program Executing a C program using an interpreter.