Problem Solving and Program Design in C
โ Scribed by Jeri Hanly, Elliot Koffman
- Publisher
- Pearson
- Year
- 2015
- Tongue
- English
- Leaves
- 842
- Edition
- 8
- Category
- Library
No coin nor oath required. For personal study only.
โฆ Synopsis
Learning to Program with ANSI-C
Problem Solving and Program Design in C teaches readers to program with ANSI-C, a standardized, industrial-strength programming language known for its power and probability. The text uses widely accepted software engineering methods to teach readers to design cohesive, adaptable, and reusable program solution modules with ANSI-C. Through case studies and real world examples, readers are able to envision a professional career in programming.
Widely perceived as an extremely difficult language due to its association with complex machinery, the Eighth Edition approaches C as conducive to introductory courses in program development. C language topics are organized based on the needs of beginner programmers rather than structure, making for an even easier introduction to the subject. Covering various aspects of software engineering, including a heavy focus on pointer concepts, the text engages readers to use their problem solving skills throughout.
โฆ Table of Contents
Cover
Title Page
Copyright Page
Preface
Contents
Chapter 0: Computer Science as a Career Path
Section 1: Why Computer Science May be the Right Field for You
Section 2: The College Experience: Computer Disciplines and Majors to Choose From
Section 3: Career Opportunities
Chapter 1: Overview of Computers and Programming
1.1. Electronic Computers Then and Now
1.2. Computer Hardware
Memory
Central Processing Unit
Input/Output Devices
Computer Networks
1.3. Computer Software
Operating System
Application Software
Computer Languages
Executing a Program
1.4. The Software Development Method
Software Development Method
Caution: Failure Is Part of the Process
1.5. Applying the Software Development Method
Case Study: Converting Miles to Kilometers
1.6. Professional Ethics for Computer Programmers
Privacy and Misuse of Data
Computer Hacking
Plagiarism and Software Piracy
Misuse of a Computer Resource
Chapter Review
Chapter 2: Overview of C
2.1. C Language Elements
Preprocessor Directives
Syntax Displays for Preprocessor Directives
Function main
Reserved Words
Standard Identifiers
User-Defined Identifiers
Uppercase and Lowercase Letters
Program Style: Choosing Identifier Names
2.2. Variable Declarations and Data Types
Variable Declarations
Data Types
Differences Between Numeric Types
Data Type char
The ASCII Code
2.3. Executable Statements
Programs in Memory
Assignment Statements
Assignment to a char Variable
Input/Output Operations and Functions
The printf Function
The scanf Function
The return Statement
2.4. General Form of a C Program
Program Style: Spaces in Programs
Comments in Programs
Program Style: Using Comments
2.5. Arithmetic Expressions
Operators / and %
Data Type of an Expression
Mixed-Type Assignment Statement
Type Conversion Through Casts
Characters as Integers
Expressions with Multiple Operators
Writing Mathematical Formulas in C
Numerical Inaccuracies
Case Study: Supermarket Coin Processor
2.6. Formatting Numbers in Program Output
Formatting Values of Type int
Formatting Values of Type double
Program Style: Eliminating Leading Blanks
2.7. Interactive Mode, Batch Mode, and Data Files
Input Redirection
Program Style: Echo Prints versus Prompts
Output Redirection
2.8. Common Programming Errors
Syntax Errors
Run-Time Errors
Undetected Errors
Logic Errors
Chapter Review
Chapter 3: Top-Down Design with Functions
3.1. Building Programs from Existing Information
Case Study: Finding the Area and Circumference of a Circle
Case Study: Computing the Weight of a Batch of Flat Washers
3.2. Library Functions
Predefined Functions and Code Reuse
Use of Color to Highlight New Constructs
C Library Functions
A Look at Where We Are Heading
3.3. Top-Down Design and Structure Charts
Case Study: Drawing Simple Diagrams
3.4. Functions Without Arguments
Function Prototypes
Function Definitions
Placement of Functions in a Program
Program Style: Use of Comments in a Program with Functions
Order of Execution of Function Subprograms and Main Function
Advantages of Using Function Subprograms
Displaying User Instructions
3.5. Functions with Input Arguments
Void Functions with Input Arguments
Functions with Input Arguments and a Single Result
Program Style: Function Interface Comment
Functions with Multiple Arguments
Argument List Correspondence
The Function Data Area
Testing Functions Using Drivers
3.6. Introduction to Computer Graphics (Optional)
Composition of a Window
Some Common Graphics Functions
Program Style: Camelback Notation
Background Color and Foreground Color
Drawing Rectangles
Drawing Circles, Ellipses, and Arcs
Program Style: Writing General Graphics Programs
Program Pitfall: Incorrect Order of Function Calls Draws over Earlier Results
Pie Slices and Filled Ellipses
Adding Text to Drawings
3.7. Common Programming Errors
Chapter Review
Chapter 4: Selection Structures: If and switch Statements
4.1. Control Structures
4.2. Conditions
Relational and Equality Operators
Logical Operators
Operator Precedence
Short-Circuit Evaluation
Writing English Conditions in C
Comparing Characters
Logical Assignment
Complementing a Condition
4.3. The If Statement
If Statement with Two Alternatives
If Statement with One Alternative
A Comparison of One and Two Alternative If Statements
Program Style: Format of the If Statement
4.4. If Statements with Compound Statements
Program Style: Writing If Statements with Compound True or False Statements
Tracing an If Statement
4.5. Decision Steps in Algorithms
Case Study: Water Bill Problem
Program Style: Consistent Use of Names in Functions
Program Style: Cohesive Functions
Program Style: Using Constant Macros to Enhance Readability and Ease Maintenance
4.6. More Problem Solving
Data Flow Information in Structure Charts
Modifying a Program with Function Subprograms
Case Study: Water Bill with Conservation Requirements
4.7. Nested If Statements and Multiple-Alternative Decisions
Comparison of Nested If and Sequence of ifs
Multiple-Alternative Decision Form of Nested if
Order of Conditions in a Multiple-Alternative Decision
Program Style: Validating the Value of Variables
Nested If Statements with More Than One Variable
4.8. The switch Statement
Comparison of Nested If Statements and the switch Statement
C in Focus: The Unix Connection
4.9. Common Programming Errors
Chapter Review
Chapter 5: Repetition and Loop Statements
5.1. Repetition in Programs
5.2. Counting Loops and the while Statement
The while Statement
5.3. Computing a Sum or a Product in a Loop
Program Style: Writing General Loops
Multiplying a List of Numbers
Compound Assignment Operators
5.4. The for Statement
Program Style: Formatting the for Statement
Increment and Decrement Operators
Increments and Decrements Other Than 1
Displaying a Table of Values
5.5. Conditional Loops
Program Style: Performing Loop Processing in a Function Subprogram
5.6. Loop Design
Sentinel-Controlled Loops
Using a for Statement to Implement a Sentinel Loop
Endfile-Controlled Loops
Infinite Loops on Faulty Data
5.7. Nested Loops
5.8. The do-while Statement and Flag-Controlled Loops
Flag-Controlled Loops for Input Validation
5.9. Iterative Approximations
Function Parameters
Case Study: Bisection Method for Finding Roots
5.10. How to Debug and Test Programs
Using Debugger Programs
Debugging Without a Debugger
Off-by-One Loop Errors
Testing
C in Focus: Team Programming
5.11. Loops in Graphics Programs (Optional)
Animation
5.12. Common Programming Errors
Chapter Review
Chapter 6: Pointers and Modular Programming
6.1. Pointers and the Indirection Operator
Indirect Reference
Pointers to Files
6.2. Functions with Output Parameters
Meanings of * Symbol
6.3. Multiple Calls to a Function with Input/Output Parameters
Program Style Preferred Kinds of Functions
6.4. Scope of Names
6.5. Formal Output Parameters as Actual Arguments
6.6. Problem Solving Illustrated
Case Study: Collecting Area for Solar-Heated House
Functions for Common Fractions
Case Study: Arithmetic with Common Fractions
6.7. Debugging and Testing a Program System
Testing Tips for Program Systems
6.8. Common Programming Errors
Chapter Review
Chapter 7: Array Pointers
7.1. Declaring and Referencing Arrays
Array Initialization
Storing a String in an Array of Characters
7.2. Array Subscripts
7.3. Using for Loops for Sequential Access
Statistical Computations Using Arrays
Program Style: Using Loop Control Variables as Array Subscripts
7.4. Using Array Elements as Function Arguments
7.5. Array Arguments
Formal Array Parameters
Argument Correspondence for Array Parameters
Arrays as Input Arguments
Returning an Array Result
Partially Filled Arrays
Stacks
7.6. Searching and Sorting an Array
Array Search
Sorting an Array
7.7. Parallel Arrays and Enumerated Types
Enumerated Types
Array with Enumerated Type Subscript
7.8. Multidimensional Arrays
Initialization of Multidimensional Arrays
Arrays with Several Dimensions
7.9. Array Processing Illustrated
Case Study: Summary of Hospital Revenue
7.10. Graphics Programs with Arrays (Optional)
Drawing a Polygon
Program Style: Using an Array of Characters to Store a Prompt
Generating Random Numbers
Seeding the Random Number Generator
Drawing a Grid
7.11. Common Programming Errors
Chapter Review
Chapter 8: Strings
8.1. String Basics
Declaring and Initializing String Variables
Arrays of Strings
Input/Output with printf and scanf
8.2. String Library Functions: Assignment and Substrings
String Assignment
Substrings
8.3. Longer Strings: Concatenation and Whole-Line Input
Concatenation
Distinction Between Characters and Strings
Scanning a Full Line
8.4. String Comparison
C in Focus: Defensive Programming
8.5. Arrays of Pointers
Arrays of String Constants
8.6. Character Operations
Character Input/Output
Character Analysis and Conversion
8.7. String-to-Number and Number-to-String Conversions
8.8. String Processing Illustrated
Case Study: Text Editor
8.9. Common Programming Errors
Chapter Review
Chapter 9: Recursion
9.1. The Nature of Recursion
9.2. Tracing a Recursive Function
Tracing a Recursive Function That Returns a Value
Tracing a void Function That Is Recursive
Parameter and Local Variable Stacks
Implementation of Parameter Stacks in C
When and How to Trace Recursive Functions
9.3. Recursive Mathematical Functions
9.4. Recursive Functions with Array and String Parameters
Case Study: Finding Capital Letters in a String
Case Study: Recursive Selection Sort
9.5. Problem Solving with Recursion
Case Study: Operations on Sets
9.6. A Classic Case Study in Recursion: Towers of Hanoi
Comparison of Iterative and Recursive Functions
9.7. Common Programming Errors
Chapter Review
Chapter 10: Structure and Union Types
10.1. User-Defined Structure Types
Structure Type Definition
Manipulating Individual Components of a Structured Data Object
Review of Operator Precedence
Manipulating Whole Structures
Program Style: Naming Convention for Types
10.2. Structure Type Data as Input and Output Parameters
10.3. Functions Whose Result Values Are Structured
C in Focus: Evolving Standards
10.4. Problem Solving with Structure Types
Case Study: A User-Defined Type for Complex Numbers
10.5. Parallel Arrays and Arrays of Structures
Parallel Arrays
Declaring an Array of Structures
Case Study: Universal Measurement Conversion
10.6. Union Types (Optional)
10.7. Common Programming Errors
Chapter Review
Chapter 11: Text and Binary File Pointers
11.1. Input/Output Files: Review and Further Study
The Keyboard and Screen as Text Streams
Newline and EOF
Escape Sequences
Formatting Output with printf
File Pointer Variables
Functions That Take File Pointer Arguments
Closing a File
11.2. Binary Files
11.3. Searching a Database
Case Study: Database Inquiry
11.4. Common Programming Errors
Chapter Review
Chapter 12: Programming in the Large
12.1. Using Abstraction to Manage Complexity
Procedural Abstraction
Data Abstraction
Information Hiding
Reusable Code
12.2. Personal Libraries: Header Files
Header Files
Cautionary Notes for Header File Design
12.3. Personal Libraries: Implementation Files
Using a Personal Library
12.4. Storage Classes
Global Variables
Storage Classes static and register
12.5. Modifying Functions for Inclusion in a Library
12.6. Conditional Compilation
12.7. Arguments to Function main
12.8. Defining Macros with Parameters
Use of Parentheses in Macro Body
Extending a Macro over Two or More Lines
12.9. Common Programming Errors
Chapter Review
Chapter 13: Pointers and Dynamic Data Structures
13.1. Pointers
Pointers as Function Parameters
Pointers Representing Functions
Pointers Representing Arrays and Strings
Pointers to Structures
Summary of Pointer Uses
13.2. Dynamic Memory Allocation
Accessing a Component of a Dynamically Allocated Structure
Dynamic Array Allocation with calloc
Returning Cells to the Heap
13.3. Linked Lists
Structures with Pointer Components
Connecting Nodes
Advantages of Linked Lists
13.4. Linked List Operators
Traversing a List
Getting an Input List
Searching a List for a Target
Avoid Following a NULL Pointer
13.5. Representing a Stack with a Linked List
13.6. Representing a Queue with a Linked List
13.7. Ordered Lists
Case Study: Maintaining an Ordered List of Integers
13.8. Binary Trees
Binary Search Tree
Searching a Binary Search Tree
Building a Binary Search Tree
Displaying a Binary Search Tree
C in Focus: Vivo 320 Videoconferencing from Your PC
13.9. Common Programming Errors
Chapter Review
Appendix A: More About Pointers
Pointer Arithmetic
Appendix B: ANSI C: Standard Libraries
Appendix C: C Operators
Bitwise Operators
Appendix D: Character Sets
Appendix E: ANSI C: Reserved Words
Glossary
Index
Back Cover
๐ SIMILAR VOLUMES
Problem Solving and Program Design in C is one of the best-selling introductory programming textbooks using the C programming language. It embraces a balanced approach to program development and an introduction to ANSI C. The book provides a gradual introduction to pointers and covers programming wi
Based on the popular Koffman style and self-teaching techniques, this new book teaches ANSI C to programmers who need an easy-to-understand introduction to the language. Using style standards that are adopted by major industrial C users, the authors convey the fundamentals of the C language without
NOTE: You are purchasing a standalone product; MyProgrammingLab does not come packaged with this content If you would like to purchase MyProgrammingLab search for ISBN-10:0134243943 /ISBN-13: 9780134243948. That package includes ISBN-10: 0134014898 /ISBN-13: 9780134014890 and ISBN-10: 013425399X /IS
For introductory courses in computer science and engineering. (Learning to Program with ANSI-C) Problem Solving and Program Design in C teaches introductory students to program with ANSI-C, a standardized, industrial-strength programming language known for its power and probability. The text uses
Learning to Program with ANSI-C<br>Problem Solving and Program Design in C teaches introductory students to program with ANSI-C, a standardized, industrial-strength programming language known for its power and probability. The text uses widely accepted software engineering methods to teach students