PDF Archive

Easily share your PDF documents with your contacts, on the Web and Social Networks.

Share a file Manage my documents Convert Recover PDF Search Help Contact



C++ .pdf



Original filename: C++.pdf
Title: 9780132848695.pdf

This PDF 1.6 document has been generated by Acrobat: pictwpstops filter 1.0 / Acrobat Distiller 7.0.5 for Macintosh, and has been sent on pdf-archive.com on 21/09/2016 at 00:31, from IP address 99.255.x.x. The current document download page has been viewed 397 times.
File size: 6.1 MB (626 pages).
Privacy: public file




Download original PDF file









Document preview


This page intentionally left blank

ENGINEERING
PROBLEM SOLVING
WITH C++
Third Edition

Delores M. Etter
Electrical Engineering Department
Southern Methodist University, Dallas, TX

Jeanine A. Ingber
Accurate Solutions in Applied Physics, LLC

Boston Columbus Indianapolis New York San Francisco Upper Saddle River
Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montréal Toronto
Delhi Mexico City São Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo

Vice President and Editorial Director, ECS:
Marcia Horton
Editor-in-Chief: Michael Hirsch
Executive Editor: Tracy Dunkelberger
Editorial Assistant: Stephanie Sellinger
Vice President, Marketing: Patrice Jones
Marketing Manager: Yezan Alayan
Marketing Coordinator: Kathryn Ferranti
Marketing Assistant: Emma Snider
Vice President, Production: Vince O’Brien
Managing Editor: Jeff Holcomb
Production Project Manager: Kayla Smith-Tarbox
Senior Operations Supervisor: Alan Fischer
Manufacturing Buyer: Lisa McDowell

Art Director: Anthony Gemmellaro
Cover Designer: Anthony Gemmellaro
Manager, Visual Research: Karen Sanatar
Photo Researcher: Lily Ferguson, Bill Smith Group
Cover Art: Mars: U.S. Geological Survey/Photo
Researchers, Inc. Arabia Dunes: NASA/
JPL-Caltech/ASU
Media Editor: Daniel Sandin
Media Project Manager: John Cassar
Full-Service Project Management and
Composition: Integra
Printer/Binder: Edwards Brothers
Cover Printer: Lehigh-Phoenix Color/Hagerstown
Text Font: 10/12, TimesNewRoman

Credits and acknowledgements borrowed from other sources and reproduced, with permission, are as follows: Chapter 1 opener
c Adam Hart-Davis/Photo Researchers, Inc.; Figure 1.2
c Dr. Jeremy Burgess/Photo
NASA/Ames Research Center; Figure 1.1
c Photo by Hulton Archive/Getty Images; Figure 1.4
c Science Source/Photo Researchers, Inc.; Figure 1.5
Researchers, Inc.; Figure 1.3
c AP Photo/Gautam Singh; Chapter 2 opener
c yuyangc/Shutterstock.com; Chapter 3 opener
c Mira.com/Howie Garber; Chapter 4

c Peter Calamai/Toronto Star/Toronto Star/Newscom; Chapter 5 opener
c NASA/Science Source/Photo Researchers, Inc.; Chapter
opener
c NASA/Science Source/Photo Researchers, Inc.; Chapter 7 opener
c HO/AFP/Getty Images/Newscom; Chapter 8 opener
c
6 opener
c Warren Faidley/Photolibrary; Chapter 10 opener
c Garry Gay/Alamy; Figure
NASA/Jet Propulsion Laboratory; Chapter 9 opener
c NASA/JPL/Ames Research Center; Insert photo I.1
c NOAA/Science Photo Library; Insert photo I.2 and I.3
c Ilene
10.1(a, b, and c)
c Mehau Kulyk/Photo Researchers, Inc.; Insert photo I.7
c NASA/Photo Researchers, Inc.;
MacDonald/Alamy; Insert photo I.4, I.5, I.6
c NASA/Jet Propulsion Laboratory; Insert photo I.10
c Scott White/UIUC/Photo Researchers; Insert photo I.11
c
Insert photo I.8 and I.9
Image generated by Robert F. Tomaro and Kenneth E. Wurtzler, Computational Sciences Branch, Air Vehicles Directorate, Air Force
c Ramon Santos/Photo Researchers, Inc.; Screenshots pg. 69–76, 123–128
c Oracle Corporation;
Research Laboratory.; Insert photo I.12
c Microsoft Corporation.
Screenshots pg. 170–174
R
R
Microsoft
and Windows
are registered trademarks of the Microsoft Corporation in the U.S.A. and other countries. Screen shots and
icons reprinted with permission from the Microsoft Corporation. This book is not sponsored or endorsed by or affiliated with the Microsoft
Corporation.

c 2012, 2008, 2003 Pearson Education, Inc., publishing as Prentice Hall 501 Boylston Street, Suite 900, Boston, MA 02116. All
Copyright
rights reserved. Printed in the United States of America. This publication is protected by Copyright, and permission should be obtained from
the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic,
mechanical, photocopying, recording, or likewise. To obtain permission(s) to use material from this work, please submit a written request to
Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to
201-236-3290.
Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations
appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Library of Congress Cataloging-in-Publication Data
Etter, D. M.
Engineering problem solving with C++ / Delores M. Etter, Jeanine A. Ingber.—3rd ed.
p. cm.
Includes bibliographical references and index.
ISBN 978-0-13-249265-2
1. C++ (Computer program language). 2. Engineering—Data processing.
I. Ingber, Jeanine A. II. Title.
QA76.73.C153E58 2012
620.00285'5117—dc23
2011033021
10 9 8 7 6 5 4 3 2 1—EB—14 13 12 11 10

ISBN 10:
0-13-249265-2
ISBN 13: 978-0-13-249265-2

In loving memory of our fathers:
Murvin Lee Van Camp,
a loving and supportive father
—Delores
Robert William Huckell,
a generous and thoughtful man
—Jeanine

Contents
Preface
1

Introduction to Computing and Engineering
Problem Solving
1.1
1.2
1.3

1.4

1.5

2

Historical Perspective
Recent Engineering Achievements
Changing Engineering Environment
Computing Systems
Computer Hardware
Computer Software
Data Representation and Storage
Number Systems
Data Types and Storage
An Engineering Problem-Solving Methodology
Summary

Simple C++ Programs

xi

2
3
7
9
11
11
12
16
17
23
26
29

34

ENGINEERING CHALLENGE: Vehicle Performance
2.1
2.2

2.3

2.4

2.5

iv

Program Structure
Constants and Variables
Scientific Notation
Numeric Data Types
Boolean Data Type
Character Data Type
String Data
Symbolic Constants
C++ Classes
Class Declaration
Class Implementation
C++ Operators
Assignment Operator
Arithmetic Operators
Precedence of Operators
Overflow and Underflow
Increment and Decrement Operators
Abbreviated Assignment Operators
Standard Input and Output
The cout Object
Stream Objects

35
39
41
42
44
44
46
47
48
48
49
52
52
54
56
58
59
60
61
61
62

Contents

2.6
2.7

2.8
2.9

3

Manipulators
The cin Object
Building C++ Solutions with IDEs: NetBeans
NetBeans
Basic Functions Included in the C++ Standard Library
Elementary Math Functions
Trigonometric Functions
Hyperbolic Functions*
Character Functions
Problem Solving Applied: Velocity Computation
System Limitations
Summary

Control Structures: Selection

v

64
67
69
69
76
77
78
80
81
81
85
86

94

ENGINEERING CHALLENGE: Global Change
3.1
3.2

3.3

3.4

3.5
3.6
3.7
3.8
3.9

4

Algorithm Development
Top-Down Design
Structured Programming
Pseudocode
Evaluation of Alternative Solutions
Conditional Expressions
Relational Operators
Logical Operators
Precedence and Associativity
Selection Statements: if Statement
Simple if Statements
if/else Statement
Numerical Technique: Linear Interpolation
Problem Solving Applied: Freezing Temperature of Seawater
Selection Statements: switch Statement
Building C++ Solutions with IDEs: NetBeans
NetBeans
Defining Operators for Programmer-Defined Data Types
Summary

Control Structures: Repetition

95
95
97
97
99
99
99
100
103
104
104
107
111
115
119
122
122
128
133

138

ENGINEERING CHALLENGE: Data Collection
4.1
4.2

4.3

Algorithm Development
Pseudocode and Flowchart Description
Repetition Structures
while Loop
do/while Loop
for Loop
Problem Solving Applied: GPS

139
140
140
141
145
148
153

vi

Contents

4.4
4.5

4.6
4.7

5

break and continue Statements
Structuring Input Loops
Counter-Controlled Loops
Sentinel-Controlled Loop
End-Of-Data Loop
Problem Solving Applied: Weather Balloons
Building C++ Solutions with IDEs: Microsoft Visual C++
Microsoft Visual C++
Summary

Working with Data Files

157
158
158
160
161
163
168
170
174

180

ENGINEERING CHALLENGE: Weather Prediction
5.1

5.2

5.3
5.4
5.5
5.6
5.7

6

Defining File Streams
Stream Class Hierarchy
ifstream Class
ofstream Class
Reading Data Files
Specified Number of Records
Trailer or Sentinel Signals
End-of-File
Generating a Data File
Problem Solving Applied: Data Filters—Modifying an HTML File
Error Checking
The Stream State
Numerical Technique: Linear Modeling∗
Problem Solving Applied: Ozone Measurements∗
Summary

Modular Programming with Functions

181
181
184
185
187
188
190
192
195
198
202
203
208
211
217

224

ENGINEERING CHALLENGE: Simulation
6.1
6.2

6.3

6.4
6.5

Modularity
Programmer-Defined Functions
Function Definition
Solution 1
Solution 2
Function Prototype
Parameter Passing
Pass by Value
Pass by Reference
Storage Class and Scope
Problem Solving Applied: Calculating a Center of Gravity
Random Numbers
Integer Sequences
Floating-Point Sequences

225
228
231
234
235
238
239
240
242
248
250
254
254
258

Contents

6.6
6.7

Problem Solving Applied: Instrumentation Reliability
Defining Class Methods
Public Interface
Accessor Methods
Mutator Methods
6.8 Problem Solving Applied: Design of Composite Materials
Solution 1
Solution 2
6.9 Numerical Technique: Roots of Polynomials*
Polynomial Roots
Incremental-Search Technique
6.10 Problem Solving Applied: System Stability*
Newton–Raphson Method*
6.11 Numerical Technique: Integration*
Integration Using the Trapezoidal Rule
Summary

7

One-Dimensional Arrays

vii

259
266
267
268
269
274
276
277
280
280
282
284
290
293
293
297

308

ENGINEERING CHALLENGE: Tsunami Warning Systems
7.1

Arrays
Definition and Initialization
Pseudocode
Computation and Output
Function Arguments
7.2 Problem Solving Applied: Hurricane Categories
7.3 Statistical Measurements
Simple Analysis
Variance and Standard Deviation
Custom Header Files
7.4 Problem Solving Applied: Speech Signal Analysis
7.5 Sorting and Searching Algorithms
Selection Sort
Search Algorithms
Unordered Lists
Ordered Lists
7.6 Problem Solving Applied: Tsunami Warning Systems
7.7 Character Strings
C Style String Definition and I/O
String Functions
7.8 The string Class
7.9 The vector class
Parameter Passing
7.10 Problem Solving Applied: Calculating Probabilities
Summary

309
310
312
315
319
324
330
330
332
335
335
341
342
343
344
344
346
352
352
354
355
357
360
362
375


Related documents


PDF Document resumesep2016 3
PDF Document amoghmannekote
PDF Document c
PDF Document akito roberge resume
PDF Document cdr reports
PDF Document resumedic


Related keywords