SM Frontmatter

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Solutions Manual

C for Engineers and Scientists


An Interpretive Approach
Harry H. Cheng
University of California, Davis
-3
-2
-1
0
1
2
3
4
0 2 4 6 8 10
a
m
p
l
i
t
u
d
e
time (second)
overdamped
critically damped
underdamped
Copyright c 2009 by The McGraw-Hill Companies, Inc., All rights reserved
Copyright c 2009 by The McGraw-Hill Companies, Inc. All rights seserved.
Permission for the exclusive use of this materials for instructors who adopted the book C for Engineers
and Scientists: An Interpretive Approach by Harry H. Cheng, published by McGraw-Hill, 2009, ISBN:
978-0-07-337605-9, as a textbook for a class is granted.
No permission for redistribution of this materials is granted.
The software is provided as is without express or implied warranty to the extent permitted by applica-
ble law.
Revision 1.0, March 2009
ii
Table of Contents
Preface to the Instructor iv
1 Introdcution 1
2 Getting Started 3
3 Number Systems, Scalar Types, and Input/Output 8
4 Operators and Expressions 18
5 Statements and Control Flow 38
6 Functions 95
7 Preprocessing Directives 154
8 Storage Classes and Program Structure 161
9 Formatted Input and Output 168
10 Arrays 180
11 Pointers 249
12 Characters and Strings 300
13 Structures, Enumerations, Unions, and Bit Fields 318
14 File Processing 341
15 Dynamic Data Structures and Cross-Platform Software Development 365
16 Scientic Computing in the Entire Real Domain in C99 382
17 Programming with Complex Numbers in C99 and C++ 388
18 Introduction to C++ 395
19 Classes and Object-Based Programming in C++ 407
20 Two- and Three-Dimensional Plotting in C++ 417
iii
21 Computational Arrays and Matrix Computations in Ch 450
22 Advanced Numerical Analysis in Ch 480
23 Introduction to MATLAB and Comparison Study with C/Ch 497
iv
Preface to the Instructor
These are solutions for exercises in each chapter in the textbook. These exercises reinforce concepts
presented in the text. Abundant exercises are designed for teaching multiple sessions without repeating
problems. The instructor is advised to look at the solutions carefully before assining the exercises in order
to determine whether the level is appropriate for the class. The degree of difculty of these exercises varies.
Some are easy whereas others are challenging even for the top students. Each chapter contains exercises
asking students to nd potential trouble spots and likely errors. Some exercises are related to the optional
topics marked with the double dagger symbol at the chapter, section, or subsection titles in the textbook.
A PDF le for exercises in each chapter and their corresponding solutions including programs are con-
tained in a separate directory. The rst line of each program contains its le name so that it can be found
easily in the directory. Many exercises have multiple solutions with different implementations using differ-
ent algorithms and ow of control. The programs presented in this solutions manual are meant to illustrate
sample implementations. Some programs in these solutions manual are not as well-documented as programs
presented in the textbook. Students should be advised to follow the coding style for on-line documentation
of programs in the textbook.
Harry H. Cheng
v

You might also like