Figure:
Computer Science
an overview
EDITION 7
J. Glenn Brookshear
Copyright © 2003 Pearson Education, Inc.
Slide 5-1
CHAPTER
5
Programming
Languages
Copyright © 2003 Pearson Education, Inc.
Slide 5-2
Figure 5.1: Generations of programming
languages
Copyright © 2003 Pearson Education, Inc.
Slide 5-3
Figure 5.2: The evolution of programming
paradigms
Copyright © 2003 Pearson Education, Inc.
Slide 5-4
Figure 5.3:
A function that
computes the
average of a
list of numbers
constructed
from the simpler
functions Sum,
Count, and
Divide
Copyright © 2003 Pearson Education, Inc.
Slide 5-5
Figure 5.4: The composition of a typical
imperative program or program unit
Copyright © 2003 Pearson Education, Inc.
Slide 5-6
Figure 5.5: The same variable declarations in
different languages
Copyright © 2003 Pearson Education, Inc.
Slide 5-7
Figure 5.6: A two-dimensional array with two
rows and nine columns
Copyright © 2003 Pearson Education, Inc.
Slide 5-8
Figure 5.7: Declaration of heterogeneous arrays in
Pascal and C (continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-9
Figure 5.7: Declaration of heterogeneous arrays in
Pascal and C
Copyright © 2003 Pearson Education, Inc.
Slide 5-10
Figure 5.8:
Control structures and their
representations
in C, C++, C#,
and Java
(continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-11
Figure 5.8: Control struc-tures and their
representations in C, C++, C#, and Java
Copyright © 2003 Pearson Education, Inc.
Slide 5-12
Figure 5.9: The for loop structure and its
representation in Pascal, C++, C#, and
Java (continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-13
Figure 5.9: The for loop structure and its
representation in Pascal, C++, C#,
and Java
Copyright © 2003 Pearson Education, Inc.
Slide 5-14
Figure 5.10: The flow of control involving a
procedure
Copyright © 2003 Pearson Education, Inc.
Slide 5-15
Figure 5.11: The procedure Project Population
written in the programming language C
Copyright © 2003 Pearson Education, Inc.
Slide 5-16
Figure 5.12: Executing the procedure Demo and
passing parameters by value (continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-17
Figure 5.12: Executing the procedure Demo and
passing parameters by value (continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-18
Figure 5.12: Executing the procedure Demo and
passing parameters by value
Copyright © 2003 Pearson Education, Inc.
Slide 5-19
Figure 5.13: Executing the procedure Demo and
passing parameters by reference
(continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-20
Figure 5.13: Executing the procedure Demo and
passing parameters by reference
(continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-21
Figure 5.13: Executing the procedure Demo and
passing parameters by reference
Copyright © 2003 Pearson Education, Inc.
Slide 5-22
Figure 5.14: The function CylinderVolume written
in the programming language C
Copyright © 2003 Pearson Education, Inc.
Slide 5-23
Figure 5.15: An example of formatted output
Copyright © 2003 Pearson Education, Inc.
Slide 5-24
Figure 5.16: The translation process
Copyright © 2003 Pearson Education, Inc.
Slide 5-25
Figure 5.17: A syntax diagram of our if-then-else
pseudocode statement
Copyright © 2003 Pearson Education, Inc.
Slide 5-26
Figure 5.18:
Syntax
diagrams
describing
the structure
of a simple
algebraic
expression
Copyright © 2003 Pearson Education, Inc.
Slide 5-27
Figure 5.19:
The parse tree
for the string
x+yz
based on the
syntax
diagrams in
Figure 5.18
Copyright © 2003 Pearson Education, Inc.
Slide 5-28
Figure 5.20: Two distinct parse trees for the
statement if B1 then if B2 then S1 else
S2 (continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-29
Figure 5.20: Two distinct parse trees for the
statement if B1 then if B2 then S1 else
S2 (continued)
Copyright © 2003 Pearson Education, Inc.
Slide 5-30
Figure 5.21: An object-oriented approach to the
translation process
Copyright © 2003 Pearson Education, Inc.
Slide 5-31
Figure 5.22: The complete program preparation
process
Copyright © 2003 Pearson Education, Inc.
Slide 5-32
Figure 5.23: The structure of a class describing a
laser weapon in a computer game
Copyright © 2003 Pearson Education, Inc.
Slide 5-33
Figure 5.24: A class with a constructor
Copyright © 2003 Pearson Education, Inc.
Slide 5-34
Figure 5.25: Our LaserClass definition using
encapsulation as it would appear in a
Java or C# program
Copyright © 2003 Pearson Education, Inc.
Slide 5-35
Figure 5.26: Resolving the statements (P OR Q)
and (R OR  Q) to produce (P OR R)
Copyright © 2003 Pearson Education, Inc.
Slide 5-36
Figure 5.27: Resolving the statements (P OR Q),
(R OR Q), R, and P
Copyright © 2003 Pearson Education, Inc.
Slide 5-37
Descargar

Programming Languages