Beschreibung
This text teaches the essentials of C programming, concentrating on what readers need to know in order to produce stand-alone programs and so solve typical scientific and engineering problems. It is a learning-by-doing book, with many examples and exercises, and lays a foundation of scientific programming concepts and techniques that will prove valuable for those who might eventually move on to another language. Written for undergraduates who are familiar with computers and typical applications but are new to programming.
Autorenportrait
Inhaltsangabe1 Programming Preliminaries.- 1.1 A Five-Step Problem-Solving Process.- 1.1.1 Step 1: Define the Problem.- 1.1.2 Step 2: Outline a Solution.- 1.1.3 Step 3: Design an Algorithm.- 1.1.4 Step 4: Convert the Algorithm Into a Program.- 1.1.5 Step 5: Verify the Operation of the Program.- 1.2 Defining a Pseudocode Language for Algorithm Development.- 1.3 Organizing Pseudocode Into a Program.- 1.4 Examples.- 1.5 What Is the Point of Programming?.- 1.6 Your First C Program.- 2 The Basics of C Programming.- 2.1 C Program Layout.- 2.2 Basic Input and Output.- 2.2.1 Keyboard Input and Monitor Output.- Reading and Displaying Numbers.- Reading and Displaying Characters and Strings of Characters.- Reading Values With Leading Zeros and Nonblank Separators.- 2.2.2 File I/O.- 2.2.3 I/O Redirection.- 2.3 Reading External Text Files of Unknown Length.- 2.4 Reading a File One Character at a Time.- 2.5 Applications.- 2.5.1 Maximum Deflection of a Beam Under Load.- 2.5.2 Relativistic Mass and Speed of an Electron.- 2.6 Debugging Your Programs.- 2.6.1 Compile-Time Errors.- 2.6.2 Run-Time Errors.- 2.7 Exercises.- 3 Data Types, Operators, and Functions.- 3.1 Specifying and Using Data Types.- 3.2 Operators.- 3.3 Type Casting.- 3.4 Intrinsic Functions.- 3.5 Simple User-Defined Functions.- 3.6 Applications.- 3.6.1 Refraction of Light.- 3.6.2 Inverse Hyperbolic Functions.- 3.7 Debugging Your Programs.- 3.7.1 Problems With Data Types and Casting.- 3.7.2 Problems With Intrinsic Functions.- 3.7.3 Problems With User-Defined Functions.- 3.8 Exercises.- 4 Selection and Repetition Constructs.- 4.1 Relational and Logical Operators.- 4.2 Selection (IF.THEN.ELSE.) Constructs.- 4.3 Choosing Alternatives From a List of Possibilities.- 4.4 Repetition (LOOP.) Constructs.- 4.4.1 Count-Controlled Loops.- 4.4.2 Conditional Loops.- Pre-Test Loops.- Post-Test Loops.- Loops for Input Validation.- 4.5 Applications.- 4.5.1 Solving the Quadratic Equation.- 4.5.2 Maximum Deflection of a Beam With Various Support/Loading Systems.- 4.5.3 Refraction of Light.- 4.5.4 Oscillating Frequency of an LC Circuit.- 4.5.5 Calculating Radiation Exposures for a Materials Testing Experiment.- 4.6 Debugging Your Programs.- 4.7 Exercises.- 5 More About Modular Programming.- 5.1 Defining Information Interfaces in C.- 5.2 Menu-Driven Programs.- 5.3 More About Function Interfaces.- 5.4 Recursive Functions.- 5.5 Using Prewritten Code Modules.- 5.6 Using Functions as Arguments and Parameters.- 5.7 Passing Arguments to the main Function.- 5.8 Applications.- 5.8.1 The Quadratic Equation Revisited.- 5.8.2 Finding Prime Numbers.- 5.8.3 The Towers of Hanoi.- 5.8.4 Trapezoidal Rule Integration.- 5.9 Debugging Your Programs.- 5.9.1 Passing Multiple Outputs Through Parameter Lists.- 5.9.2 Recursive Functions.- 5.9.3 Reusable Code.- 5.10 Exercises.- 6 Arrays.- 6.1 Arrays in Structured Programming.- 6.2 One-Dimensional Array Implementation in C.- 6.3 Using Arrays in Function Calls.- 6.4 Multidimensional Arrays.- 6.5 Accessing Arrays With Pointers.- 6.6 More About Strings.- 6.6.1 Strings as Arrays.- 6.6.2 String Functions.- 6.7 Applications.- 6.7.1 Cellular Automata and Sierpinski Triangles.- 6.7.2 Probability Analysis for Quality Control of Manufacturing Processes.- 6.7.3 Parsing a String Containing an Unknown Number of Numerical Values.- 6.8 Debugging Your Programs.- 6.9 Exercises.- 7 User-Defined Data Objects.- 7.1 Creating User-Defined Data Objects.- 7.2 Arrays of Structures.- 7.3 Functions With Structures as Parameters and Data Types.- 7.4 Applications.- 7.4.1 Finding the Perimeter and Area of a Plot of Land.- 7.4.2 A Set of Functions to Perform Operations on Complex Numbers.- 7.4.3 Analyzing Data From a Datalogger.- 7.5 Debugging Your Programs.- 7.6 Exercises.- 8 Searching and Sorting Algorithms.- 8.1 Introduction.- 8.2 Searching Algorithms.- 8.2.1 Linear Searches.- 8.2.2 Binary Search.- 8.2.3 Choosing a Searching Algorithm.- 8.3 Sorting Algorithms.- 8.3.1 Selection Sort.- 8.3.2 Insertion Sort.- 8.3