Absolute C++ with MyProgrammingLab: International Editions - Walter Savitch

Absolute C++ with MyProgrammingLab: International Editions

Walter Savitch (Autor)

Media-Kombination
2012 | 5th edition
Pearson Education Limited
978-0-273-76935-4 (ISBN)
109,25 inkl. MwSt
zur Neuauflage
  • Titel erscheint in neuer Auflage
  • Artikel merken
Zu diesem Artikel existiert eine Nachauflage
For undergraduate students in Computer Science and Computer Programming courses.

Praised for providing an engaging balance of thoughtful examples and explanatory discussion, best-selling author Walt Savitch and contributor Kenrick Mock explain concepts and techniques in a straightforward style using understandable language and code enhanced by a suite of pedagogical tools. Absolute C++ is appropriate for both introductory and intermediate programming courses introducing C++.

MyProgrammingLab, Pearson's online homework and assessment tool, is available with this edition.

>Contents

Chapter 1 C++ Basics   1

1.1 Introduction to C++ 2

Origins of the C++ Language 2

C++ and Object-Oriented Programming 3

The Character of C++ 3

C++ Terminology   4

A Sample C++ Program   4

1.2 Variables, Expressions, and Assignment Statements   6

Identifiers   6

Variables   8

Assignment Statements   10

Pitfall: Uninitialized Variables   12

Tip: Use Meaningful Names   13

More Assignment Statements 13

Assignment Compatibility   14

Literals   15

Escape Sequences   17

Naming Constants   17

Arithmetic Operators and Expressions   19

Integer and Floating-Point Division   21

Pitfall: Division with Whole Numbers   22

Type Casting   22

Increment and Decrement Operators   25

Pitfall: Order of Evaluation   27

1.3 Console Input/Output   28

Output Using cout   28

New Lines in Output   29

Tip: End Each Program with /n or endl   30

Formatting for Numbers with a Decimal Point   31

Output with cerr   32

Input Using cin   32

Tip: Line Breaks in I/O 34

1.4 Program Style   34

Comments   35

1.5 Libraries and Namespaces   35

Libraries and include Directives   36

Namespaces   36

Pitfall: Problems with Library Names   37

Chapter Summary:   38

Answers to Self-Test Exercises   39

Programming Projects   40



Chapter 2 Flow of Control   43

2.1 Boolean Expressions   44

Building Boolean Expressions   44

Pitfall: Strings of Inequalities   45

Evaluating Boolean Expressions   46

Precedence Rules   48

Pitfall: Integer Values Can Be Used as Boolean Values   52

2.2 Branching Mechanisms   54

if-else Statements   54

Compound Statements   56

Pitfall: Using = in Place of ==   57

Omitting the else   59

Nested Statements   59

Multiway if-else Statement   59

The switch Statement   60

Pitfall: Forgetting a break in a switch Statement   63

Tip: Use switch Statements for Menus   63

Enumeration Types   64

The Conditional Operator   64

2.3 Loops   65

The while and do-while Statements   66

Increment and Decrement Operators Revisited   68

The Comma Operator   70

The for Statement   72

Tip: Repeat-N-Times Loops   74

Pitfall: Extra Semicolon in a for Statement   75

Pitfall: Infinite Loops   75

The break and continue Statements   78

Nested Loops   81

2.4 Introduction to File Input

Reading From a Text File Using ifstream

Chapter Summary   81

Answers to Self-Test Exercises   82

Programming Projects   87



Chapter 3 Function Basics   91

3.1 Predefined Functions   92

Predefined Functions That Return a Value   92

Predefined void Functions   97

A Random Number Generator   99

3.2 Programmer-Defined Functions   103

Defining Functions That Return a Value   103

Alternate Form for Function Declarations   106

Pitfall: Arguments in the Wrong Order   107

Pitfall: Use of the Terms Parameter and Argument   107

Erscheint lt. Verlag 21.6.2012
Verlagsort Harlow
Sprache englisch
Maße 188 x 233 mm
Gewicht 1310 g
Themenwelt Schulbuch / Wörterbuch
Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Informatik Software Entwicklung Objektorientierung
ISBN-10 0-273-76935-9 / 0273769359
ISBN-13 978-0-273-76935-4 / 9780273769354
Zustand Neuware
Haben Sie eine Frage zum Produkt?