Download

Chapter 8: Introduction to High-Level Language Programming






Advertisement
Download Presentation
Comments
corina
From:
|  
(568) |   (0) |   (0)
Views: 85 | Added: 16-10-2012
Rate Presentation: 1 0
Description:
Invitation to Computer Science, C Version, Fourth Edition. 2. Objectives. In this chapter, you will learn aboutWhy High-level languagesIntroduction to C Object-oriented programmingSoftware engineering. Invitation to Computer Science, C Version, Fourth Edition. 3. Where Do We Stand?. Early
Chapter 8: Introduction to High-Level Language Programming

An Image/Link below is provided (as is) to

Download Policy: Content on the Website is provided to you AS IS for your information and personal use only and may not be sold or licensed nor shared on other sites. SlideServe reserves the right to change this policy at anytime. While downloading, If for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.











- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




1. Chapter 8: Introduction to High-Level Language Programming Invitation to Computer Science, C++ Version, Fourth Edition

2. Invitation to Computer Science, C++ Version, Fourth Edition 2 Objectives In this chapter, you will learn about Why High-level languages Introduction to C++ Object-oriented programming Software engineering

3. Invitation to Computer Science, C++ Version, Fourth Edition 3 Where Do We Stand? Early days of computing Programmers used assembly language Programs written by technically oriented people Later decades Programmers demanded a more comfortable programming environment Programs could be written by ?nontechie? people

4. Invitation to Computer Science, C++ Version, Fourth Edition 4 High-level Languages High-level programming languages (C++/Java) Called third-generation languages Overcame deficiencies of assembly language Programmer didn?t need to manage details of data storage or movement

5. Invitation to Computer Science, C++ Version, Fourth Edition 5 Which is better? High Level Language - a macroscopic view Assembly ? a ?primitive operations? view High Level Language: A = B + C Assembly Code LOAD B ADD C STORE A

6. Invitation to Computer Science, C++ Version, Fourth Edition 6

7. Invitation to Computer Science, C++ Version, Fourth Edition 7 Figure 8.1 Transitions of a High-level Language Program

8. Invitation to Computer Science, C++ Version, Fourth Edition 8 Sample Quizzes (T/F) High level language is used in the early days of computing. (T/F) High level languages are called second-generation languages. (T/F) Assembler translates assembly code to machine code. (T/F)

9. Invitation to Computer Science, C++ Version, Fourth Edition 9 Introduction to C++ Some components of program in Figure 8.2 Comments Give information to human readers of code Include directive The linker includes object code from a library Using directive Tells compiler to look in a namespace for definitions not mentioned in the program

10. Invitation to Computer Science, C++ Version, Fourth Edition 10 Figure 8.2 A Simple C++ Program

11. Invitation to Computer Science, C++ Version, Fourth Edition 11 Figure 8.3 The Overall Form of a Typical C++ Program

12. Invitation to Computer Science, C++ Version, Fourth Edition 12 Virtual Data Storage Identifiers: Names in a programming language Keywords: Have special meanings in C++ C++ is a case-sensitive, free-format language Data items can be constants or variables

13. Invitation to Computer Science, C++ Version, Fourth Edition 13 Virtual Data Storage (continued) A declaration of a data item tells Whether the item is a constant or a variable The identifier used to name the item The data type of the item

14. Invitation to Computer Science, C++ Version, Fourth Edition 14 Figure 8.5 Some of the C++ Standard Data Types

15. Invitation to Computer Science, C++ Version, Fourth Edition 15 Statement Types Input/output statements Input statement Collects a specific value from the user for a variable within the program Output statement Writes a message or the value of a program variable to the user?s screen or to a file

16. Invitation to Computer Science, C++ Version, Fourth Edition 16 Statement Types (continued) Assignment statement Assigns a value to a program variable Control statement Directs the flow of control Can cause it to deviate from usual sequential flow

17. Invitation to Computer Science, C++ Version, Fourth Edition 17 Input/Output Statements Example Pseudocode Get value for Radius C++ cin >> Radius; cin: Input stream Code for extraction operator (>>) and the definition of the cin stream come from the iostream library and std namespace

18. Invitation to Computer Science, C++ Version, Fourth Edition 18 Input/Output Statements (continued) Example Pseudocode Print the value of Circumference C++ cout << Circumference; cout: Output stream Code for the insertion operator (<<) and the definition of the cout stream come from the iostream library and std namespace

19. Invitation to Computer Science, C++ Version, Fourth Edition 19 The Assignment Statement General form Pseudocode Set the value of ?variable? to ?arithmetic expression? C++ variable = expression; Expression on the right is evaluated The result is written into the memory location specified on the left

20. Invitation to Computer Science, C++ Version, Fourth Edition 20 Control Statements Types of control mechanisms Sequential Instructions are executed in order Conditional Choice of which instructions to execute next depends on some condition Looping Group of instructions may be executed many times

21. Invitation to Computer Science, C++ Version, Fourth Edition 21 Control Statements (continued) Sequential is the default mode of execution Conditional flow of control Evaluation of a Boolean condition (also called a Boolean expression) Which programming statement to execute next is based on the value of the Boolean condition (true or false)

22. Invitation to Computer Science, C++ Version, Fourth Edition 22 Control Statements (continued) Conditional flow of control (continued) if-else statement if (Boolean condition) S1; else S2; Ex: if( X > 10) y = 10; else y = 5;

23. Invitation to Computer Science, C++ Version, Fourth Edition 23 if variation of the if-else statement

24. Invitation to Computer Science, C++ Version, Fourth Edition 24 Figure 8.10 Conditional Flow of Control (If-Else)

25. Invitation to Computer Science, C++ Version, Fourth Edition 25 Figure 8.11 If-Else with Empty Else

26. Invitation to Computer Science, C++ Version, Fourth Edition 26 Sample Quizzes (T/F) C++ is a high level programming language. (T/F) The following C++ statement is OK. (T/F) int amount; amount = 2.6; The following C++ statement is OK. (T/F) double amount; amount = ?A?;

27. Invitation to Computer Science, C++ Version, Fourth Edition 27 Sample Quizzes (T/F) Y is 5 in the following statements. (T/F) int x, y; x = 4; if (x > 5) y = 1; else y = 5;

28. Invitation to Computer Science, C++ Version, Fourth Edition 28 Control Statements (continued) Looping (iteration) The loop body may be executed repeatedly based on the value of the Boolean condition while statement while (Boolean condition) S1;

29. Invitation to Computer Science, C++ Version, Fourth Edition 29 Figure 8.12 While Loop

30. Invitation to Computer Science, C++ Version, Fourth Edition 30 Sample Quizzes What is final value of y? _____ Setp 5 is executed _____ times. 1. int x = 2, y = 0; 2. while (x > 3) 3. { 4. y = y + 2; 5. x = x + 1; 6. }

31. Invitation to Computer Science, C++ Version, Fourth Edition 31 Sample Quizzes What is final value of y? _____ Setp 5 is executed _____ times. 1. int x = 1, y = 1; 2. while (x > 3) 3. { 4. y = y + 2; 5. x = x + 1; 6. }

32. Invitation to Computer Science, C++ Version, Fourth Edition 32 Managing Complexity: Divide and Conquer Divide and conquer To solve a problem, divide it into smaller pieces In a computer program Divide the code into modules (subprograms), each doing a part of the overall task Empower these modules to work together to solve the original problem

33. Invitation to Computer Science, C++ Version, Fourth Edition 33 Figure 8.17 A Structure Chart

34. Invitation to Computer Science, C++ Version, Fourth Edition 34 Divide and Conquer Example Task: ATM application module 1: users validation module 2: menu selection module 3: deposit module 4: withdraw ATM problem is divided into 4 smaller modules.

35. Invitation to Computer Science, C++ Version, Fourth Edition 35 Using Functions Function A module of code in C++ 2 Types of functions: Subtask functions: Optional The main function: Mandatory

36. Invitation to Computer Science, C++ Version, Fourth Edition 36 Sample Quizzes The ?divide and solve? technique divides the problem into smaller pieces. (T/F) A module of code in C++ is called function and is mandatory. (T/F) C++ programmers must use ?divide and conquer? to solve problems. (T/F)

37. Invitation to Computer Science, C++ Version, Fourth Edition 37 Object-Oriented Programming Object-oriented programming (OOP) A program consists of a group of objects and is implemented by sending messages to objects. In OOP, ATM contains ?user?, ?deposit? and ?withdraw? objects and ?Validating?, ?Adding?, ?Subtracting? messages.

38. Invitation to Computer Science, C++ Version, Fourth Edition 38 What is an object? An object is a ?thing? that can perform a set of activities. ?Student? is an object that can perform driving, studying,...

39. Invitation to Computer Science, C++ Version, Fourth Edition 39 No. 1 Key elements of OOP Encapsulation Each object?s data and logic is hidden from other objects. For example, the details of the engine is hidden from the ?driver.?

40. Invitation to Computer Science, C++ Version, Fourth Edition 40 No. 2 Key elements of OOP Inheritance Allow an object to have the same behavior as another object and have additional behavior for specific needs.

41. Invitation to Computer Science, C++ Version, Fourth Edition 41 No. 3 Key elements of OOP Polymorphism Allow two or more objects to respond the same message differently.

42. Invitation to Computer Science, C++ Version, Fourth Edition 42 Sample Quizzes OOP stands for Object-Oriented Problems. (T/F) The communication between objects is through sending money. (T/F) Polygon is one of key elements of OOP. (T/F) Encapsulation of OOP allows an object to have the same behavior as another object and have additional behavior for specific needs. Inheritance of OPP allows one or more objects respond to the same message.

43. Invitation to Computer Science, C++ Version, Fourth Edition 43 What Have We Gained? Two major advantages of OOP Software reuse A more natural ?world view?

44. Invitation to Computer Science, C++ Version, Fourth Edition 44 Software life cycle The feasibility study Problem specification Program design Algorithm selection or development, and analysis Coding Debugging Testing, verification, and benchmarking Documentation Maintenance

45. Invitation to Computer Science, C++ Version, Fourth Edition 45 Sample Quizzes Software rewrite is one of OOP benefits. (T/F) The first step of software life cycle is program specification. (T/F) The last step of software life cycle is documentation. (T/F) In software life cycle, the coding occurs before the program design. (T/F)


Other Related Presentations

Copyright © 2014 SlideServe. All rights reserved | Powered By DigitalOfficePro