图书介绍
The art and science of C a library-based introduction to computer science = C语言的科学和艺术 (英文版)PDF|Epub|txt|kindle电子书版本网盘下载
![The art and science of C a library-based introduction to computer science = C语言的科学和艺术 (英文版)](https://www.shukui.net/cover/14/33904357.jpg)
- Eric Roberts 著
- 出版社: China Machine Press
- ISBN:7111139917
- 出版时间:2004
- 标注页数:706页
- 文件大小:83MB
- 文件页数:739页
- 主题词:C语言-程序设计-英文
PDF下载
下载说明
The art and science of C a library-based introduction to computer science = C语言的科学和艺术 (英文版)PDF格式电子书版下载
下载的文件为RAR压缩包。需要使用解压软件进行解压得到PDF格式图书。建议使用BT下载工具Free Download Manager进行下载,简称FDM(免费,没有广告,支持多平台)。本站资源全部打包为BT种子。所以需要使用专业的BT下载软件进行下载。如BitComet qBittorrent uTorrent等BT下载工具。迅雷目前由于本站不是热门资源。不推荐使用!后期资源热门了。安装了迅雷也可以迅雷进行下载!
(文件页数 要大于 标注页数,上中下等多册电子书除外)
注意:本站所有压缩包均有解压码: 点击下载压缩包解压工具
图书目录
1 Introduction1
1.1 A brief history of computing2
1.2 What is computer science?4
1.3 A brief tour of computer hardware6
The CPU7
Memory7
Secondary storage8
I/O devices8
1.4 Algorithms9
1.5 Programming languages and compilation10
1.6 Programming errors and debugging12
1.7 Software maintenance13
1.8 The importance of software engineering14
1.9 Some thoughts on the C programming language15
Summary16
REVIEW QUESTIONS17
PART ONE The Basics of C Programming19
2 Learning by Example21
2.1 The “Hello world” program22
Comments22
Library inclusions23
The main program24
2.2 A program to add two numbers26
The input phase28
The computation phase30
The output phase30
2.3 Perspectives on the programming process32
2.4 Data types33
Floating-point data34
String data34
2.5 Expressions37
Constants38
Variables39
Assignment statements41
Operators and operands43
Combining integers and floating-point numbers44
Integer division and the remainder operator45
Precedence45
Applying precedence rules48
Type conversion48
Summary51
REVIEW QUESTIONS52
PROGRAMMING EXERCISES55
3 Problem Solving59
3.1 Programming idioms and paradigms60
Shorthand assignment idioms61
Increment and decrement operators62
3.2 Solving problems on a larger scale63
3.3 Control statements65
The repeat-N-times idiom65
Iteration and loops67
Index variables67
The importance of initialization69
The read-until-sentinel idiom69
Building a more practical application71
Conditional execution and the if statement74
3.4 An exercise in debugging76
3.5 Formatted output80
Format codes for printf82
Controlling spacing,alignment,and precision83
3.6 Crafting a program86
Programming style86
Designing for change88
The #define mechanism89
Summary89
REVIEW QUESTIONS91
PROGRAMMING EXERCISES93
4 Statement Forms99
4.1 Simple statements100
Embedded assignments102
Multiple assignments102
Blocks103
4.2 Control statements104
4.3 Boolean data105
Relational operators106
Logical operators107
Shortircuit evaluation109
Flags110
Avoiding redundancy in Boolean expressions110
An example of Boolean calculation111
4.4 The if statement112
Single-line if statements114
Multiline if statements114
The if-else statement114
Cascading if statements115
The ?:operator115
4.5 The switch statement117
4.6 The while statement119
Using the while loop120
Infinite loops122
Solving the loopand-a-half problem123
4.7 The for statement125
Nested for loops126
The relationship between for and while129
Using for with floating-point data129
Summary131
REVIEW QUESTIONS132
PROGRAMMING EXERCISES133
5 Functions137
5.1 Using library functions138
5.2 Function declarations140
5.3 Writing your own functions141
The return statement142
Putting functions together with main programs143
Functions involving internal control structures145
Functions that return nonnumeric values146
Predicate functions148
A predicate function to test for string equality149
5.4 Mechanics of the function-calling process150
Parameter passing151
Calling functions from within other functions156
5.5 Procedures163
5.6 Stepwise refinement165
Starting at the top166
Implementing PrintCalendar167
Implementing PrintCalendarMonth167
Completing the final pieces171
Summary176
REVIEW QUESTIONS177
PROGRAMMING EXERCISES178
6 Algorithms185
6.1 Testing for primality186
A simple version of IsPrime187
Verifying that a strategy represents an algorithm187
Demonstrating the correctness of the IsPrime algorithm188
Improving algorithmic efficiency189
Choosing between alternative implementations192
6.2 Computing the greatest common divisor193
Brute-force algorithms194
Euclid’s algorithm195
Defending the correctness of Euclid’s algorithm195
Comparing the efficiency of the GCD algorithms197
6.3 Numerical algorithms197
Successive approximation198
Reporting errors200
6.4 Series expansion201
Zeno’s paradox201
Using a series expansion for the square root function203
The Taylor series expansion for approximating a square root204
Implementing the Taylor series approximation205
Staying within the radius of convergence207
6.5 Specifying the size of numeric types210
Integer types210
Unsigned types211
Floating-point types212
Summary212
REVIEW QUESTIONS213
PROGRAMMING EXERCISES214
PART TWO Libraries and Modular Development219
7 Libraries and Interfaces:A Simple Graphics Library221
7.1 The concept of an interface222
Interfaces and header files224
7.2 An introduction to the graphics library225
The underlying model for graphics.h225
The functions in the graphics.h interface227
Initializing the package231
Drawing straight lines231
Drawing circles and arcs233
Obtaining informa-tion about the graphics window235
7.3 Building your own tools235
Defining DrawBox236
Defining DrawcenteredCircle237
Switching between absolute and relative coordinates239
The advantages of defining procedures240
7.4 Solving a larger problem240
Using stepwise refinement241
Implementing the DrawHouse procedure242
Looking for common patterns243
Finishing the decomposition245
Summary250
REVIEW QUESTIONS251
PROGRAMMING EXERCISES252
8 Designing Interfaces:A Random Number Library259
8.1 Interface design260
The importance of a unifying theme261
Simplicity and the principle of information hiding261
Meeting the needs of your clients263
The advantages of general tools263
The value of stability264
8.2 Generating random numbers by computer265
Deterministic versus nondeterministic behavior265
Random versus pseudo-random numbers265
Generating pseudo-random numbers in ANSI C266
Changing the range of random numbers267
Generalizing the problem272
8.3 Saving tools in libraries274
The contents of an interface275
Writing the random.h interface276
The random.c implementation277
Constructing a client program278
Initializing the random number generator280
8.4 Evaluating the design of the random.h interface283
Generating random real numbers284
Simulating a probabilistic event285
Including header files in an interface286
Completing the implementation of the random-number package286
8.5 Using the random-number package286
Summary290
REVIEW QUESTIONS291
PROGRAMMING EXERCISES292
9 Strings and Characters301
9.1 The principle of enumeration302
Representing enumeration types inside the machine303
Representing enumeration types as integers304
Defining new enumeration types304
Operations on enumeration types307
Scalar types307
9.2 Characters308
The data type char308
The ASCII code308
Character constants310
Important properties of the ASCII coding scheme310
Special characters311
Character arithmetic312
The ctype.h interface314
Control statements involving characters315
Character input and output316
9.3 Strings as abstract data316
Layered abstractions317
The concept of an abstract type319
9.4 The strlib.h interface319
Determining the length of a string320
Selecting characters from a string321
Concatenation321
Converting characters to strings322
Extracting parts of a string323
Comparing one string with another324
Searching within a string325
Case conversion327
Numeric conversion329
Efficiency and the strlib.h library330
Summary331
REVIEW QUESTIONS332
PROGRAMMING EXERCISES334
10 Modular Development339
10.1 Pig Latin—a case study in modular development342
Applying top-down design342
Using pseudocode343
Implementing TranslateLine344
Taking spaces and punctuation into account345
Refining the definition of a word347
Designing the token scanner348
Completing the TranslateLine implementation349
Specifying the scanner module interface352
10.2 Maintaining internal state within a module352
Global variables355
The dangers of using global variables356
Keeping variables private to a module356
Initializing global variables357
Private functions359
10.3 Implementing the scanner abstraction359
Summary366
REVIEW QUESTIONS366
PROGRAMMING EXERCISES367
PART THREE Compound Data Types373
11 Arrays375
11.1 Introduction to arrays376
Array declaration377
Array selection378
Example of a simple array379
Changing the index range381
11.2 Internal representation of data382
Bits,bytes,and words382
Memory addresses383
The sizeof operator385
Allocation of memory to variables385
References to elements outside the array bound386
11.3 Passing arrays as parameters388
Generalizing the number of elements390
The mechanics of array parameter transmission392
Implementing Print IntegerArray and GetIntegerArray394
Implementing Reverse IntegerArray396
Implementing SwapIntegerElements397
11.4 Using arrays for tabulation398
11.5 Static initialization of arrays404
Automatic determination of array size408
Determining the size of an initialized array409
Initialized arrays and scalar types409
11.6 Multidimensional arrays410
Passing multidimensional arrays to functions411
Initializing multidimensional arrays412
Summary413
REVIEW QUESTIONS414
PROGRAMMING EXERCISES416
12 Searching and Sorting425
12.1 Searching426
Searching in an integer array426
A more sophisticated example of searching429
Linear search431
Binary search433
Relative efficiency of the search algorithms435
12.2 Sorting437
Sorting an integer array437
The selection sort algorithm438
Evaluating the efficiency of selection sort442
Measuring the running time of a program442
Analyzing the selection sort algorithm445
Summary446
REVIEW QUESTIONS446
PROGRAMMING EXERCISES447
13 Pointers453
13.1 Using addresses as data values455
13.2 Pointer manipulation in C457
Declaring pointer variables in C457
The fundamental pointer operations458
The special pointer NULL461
13.3 Passing parameters by reference461
Designing a swapInteger function465
Using call by reference to return multiple results466
The danger of overusing call by reference467
13.4 Pointers and arrays468
Pointer arithmetic469
New capabilities of the ++ and -- operators473
Incrementing and decrementing pointers475
The relationship between pointers and arrays476
13.5 Dynamic allocation478
The type void 478
Dynamic arrays480
Detecting errors in malloc481
Freeing memory481
Summary482
REVIEW QUESTIONS483
PROGRAMMING EXERCISES486
14 Strings Revisited491
14.1 Conceptual representations of the type string492
Strings as arrays491
Strings as pointers495
Strings as an abstract type496
String parameters497
String variables497
Differences between pointer and array variables499
Deciding on a strategy for string representation502
14.2 The ANSI string library502
The strcpy function504
The strncpy function507
The strcat and strncat functions508
The strlen,strcmp,and strncmp functions509
The strchr,strrchr,and strstr functions510
An application of the ANSI string functions510
14.3 Implementing the strlib library511
Implementing the pass-through functions511
Implementing the strlib allocation functions514
Summary516
REVIEW QUESTIONS517
PROGRAMMING EXERCISES517
15 Files523
15.1 Text files524
15.2 Using files in C525
Declaring a FILE * variable526
Opening a file526
Performing I/O operations527
Closing files528
Standard files528
15.3 Character I/O529
Updating a file531
Rereading characters in the input file533
15.4 Line-oriented I/O536
15.5 Formatted I/O539
The three forms of printf539
The scanf functions539
Reading strings with scanf541
An example of formatted I/O543
Limitations on the use of scanf546
Summary547
REVIEW QUESTIONS548
PROGRAMMING EXERCISES549
16 Records557
16.1 The concept of the data record558
16.2 Using records in C559
Defining a new structure type560
Declaring structure variables560
Record selection561
Initializing records561
Simple records562
16.3 Combining records and arrays563
16.4 Pointers to records566
Defining a pointer-to-record type566
Allocating storage for record data568
Manipulating pointers to records569
16.5 Building a database of records570
Creating the employee database570
Using the database573
16.6 Designing a record-based application574
The importance of using a database575
Framing the problem575
Designing the internal representation576
Designing the external structure580
Coding the program581
The value of a data-driven design588
Summary589
REVIEW QUESTIONS592
PROGRAMMING EXERCISES593
17 Looking Ahead601
17.1 Recursion602
A simple illustration of recursion603
The Factorial function604
The recursive leap of faith609
The recursive paradigm610
Generating permutations611
Thinking recursively614
17.2 Abstract data types614
The queue abstraction615
Representing types in the queue abstraction616
The queue.h interface618
Implementing the queue abstraction620
Alternative implementation of the queue abstraction622
17.3 Analysis of algorithms628
Evaluating algorithmic efficiency628
Big-O notation629
Selection sort revisited630
Divide-and-conquer strategies631
Merging two arrays632
The merge sort algorithm633
The computational complexity of merge sort635
Comparing quadratic and N log N performance636
Summary637
REVIEW QUESTIONS638
PROGRAMMING EXERCISES639
Appendix A.Summary of C Syntax and Structure647
A.1 An overview of the compilation process648
A.2 The C preprocessor648
A.3 The lexical structure of C programs650
A.4 Expressions652
A.5 Statements653
A.6 Functions657
A.7 Declarations658
A.8 Data types659
A.9 ANSI libraries662
Appendix B.Library Sources669
Index696