C++ for Lazy Programmers
Apress (Verlag)
978-1-4842-5186-7 (ISBN)
- Titel erscheint in neuer Auflage
- Artikel merken
C++ for Lazy Programmers is a genuinely fun learning experience that will show you how to create programs in the C++ language. This book helps you learn the C++ language with a unique method that goes beyond syntax and how-to manuals and helps you understand how to be a productive programmer. It provides detailed help with both the Visual Studio and g++ compilers plus their debuggers, and includes the latest version of the language, C++17, too.
Along the way you’ll work through a number of labs: projects intended to stretch your abilities, test your new skills, and build confidence. You'll go beyond the basics of the language and learn how build a fun C++ arcade game project. After reading and using this book, you’ll be ready for your first real-world C++ application or game project on your own.
What You Will Learn
Program for the first time in C++ in a fun, quick and easy manner
Discover the SDL graphics and gaming library
Work with SSDL, the Simple SDLwrapper library
Use the most common C++ compilers: Visual Studio, and g++ (with Unix or MinGW)
Practice “anti-bugging” for easy fixes to common problems
Work with the debugger
Acquire examples-driven concepts and ideas
Build a C++-based arcade game application
Apply built-in Standard Template Library (STL) functions and classes for easy and efficient programming
Dip your toe in C, C++'s ancestor, still extensively used in industry
Use new C++11/14/17 features including lambda functions, constexpr, and smart pointers
Who This Book Is For
Those who are new to C++, either as a guide for self-learners or as an accessible textbook for students in college-level courses.
Will Briggs, PhD is a professor of computer science at the University of Lynchburg in Virginia. He has 20+ years of experience teaching C++, 12 of them using earlier drafts of this book, and about as many years teaching other languages including C, LISP, Pascal, PHP, PROLOG, and Python. His primary focus is teaching of late while also active in research in artificial intelligence.
The text is around 120,000 words long. Most chapters take one week each to cover in a standard (3- or 4-hour) college class. It covers two semesters, with a few extra chapters at the end for those wanting to go further.
Chapter 1-13 are for semester one, covering variables, constants, types including enumeration types, control structures, functions, standard I/O, programming style, algorithm development, and the debugger. The climax of the sequence is Chapter 12, Building Your Own Arcade Game. As it stands now, all but Chapter 13 use a graphics library for whiz-bang.
Chapter 14-23 are for the second semester, covering character arrays, pointers and dynamic memory, classes, inheritance, templates including the Standard Template Library, exceptions, virtual functions, and elementary data structures (strings, stacks, queues, vectors, and lists). The climax of this sequence is the construction of linked lists. Only Chapter 21 uses graphics -- the rest use standard console I/O, which is essential before going on to subsequent classes in the major.
Chapters 24-29 are optional extras: namespaces, construction of libraries, history of C++, bit twiddling, sstream, shared_ptr, the C language, and other topics.
Appendices cover setting up the graphics library on your machine, escape sequences, keywords, standard libraries, g++ debugger commands, and graphics-library functions.
Introduction. 1-1
1 Getting started. 1-9
1.1 A simple program.. 1-9
1.2 Creating an SSDL project 1-12
1.3 Shapes, and the functions that draw them.. 1-27
1.4 consts and colors. 1-35
1.5 Text 1-37
First week.
Prominent examples from this chapter: a drawing of a bug's head; a neatly printed poem.
2 Images and sound. 2-43
2.1 Images, and changing window characteristics. 2-43
2.2 Multiple images together 2-48
2.3 Sound. 2-51
Second week.
Example: a slide show (Your yard gnome's travel pics).
3 Math: types, operations, consts, and math functions. 3-55
3.1 Variables, constants, enums as constants. 3-55
3.2 Math operators. 3-57
3.3 Mathematical functions. 3-61
Third week.
Examples: diver on a diving board; a 5-pointed star.
4 Mouse, and if. 4-67
4.1 Mouse functions, and variables associated. 4-67
4.2 if.. 4-69
4.3 Boolean variables. 4-73
4.4 Where Waldo is: using mouse input 4-75
Fourth week.
Example: Where's Waldo? (pending approval from Waldo's author).
5 Loops and text input 5-79
5.1 Text input 5-79
5.2 while and do-while. 5-81
5.3 for-loops. 5-85
5.4 The char type, and cctype.. 5-90
5.5 switch.. 5-94
Fifth week.
Examples: the Monty Hall problem; menus.
6 Algorithms and the development process. 6-97
6.1 The Biscuit Algorithm, or how planning ahead reduces your workload. 6-97
6.2 Writing a program, from start to finish. 6-100
Sixth week.
7 Functions. Example: a multi-panel comic. 7-106
7.1 Functions that return values. 7-106
7.2 Functions that return nothing. 7-110
7.3 Why have functions, anyway?. 7-117
Still sixth week.
Example: a multi-frame comic (illustrates code reuse).
8 Functions (cont'd). Example: various random functions. 8-126
8.1 Boolean functions. 8-126
8.2 Random numbers. 8-127
8.3 Multiple values provided: using & parameters. 8-133
8.4 Identifier scope 8-138
8.5 A final note on algorithms. 8-140
Seventh and eighth weeks.
Examples: various functions using random number generation.
9 Using the debugger (optional, recommended) 9-141
9.1 Example: drawing a flag. 9-141
9.2 A debugger session in Visual Studio. 9-145
9.3 Debugging g++ programs with ddd and gdb. 9-150
9.4 Other common debugging techniques. 9-156
Ninth week.
10 enum and arrays. 10-159
10.1 Enumeration types. 10-159
10.2 Arrays. 10-160
10.3 Multidimensional arrays. 10-166
Tenth week.
Examples: checkers, tic-tac-toe.
11 animation with structs and sprites. 11-173
11.1 struct.. 11-173
11.2 Making a movie with struct and while.. 11-176
11.3 Sprites. 11-182
Eleventh week.
Examples: bouncing balls; a video aquarium.
12 Building your own arcade game: input, collisions, and putting it all together 12-188
12.1 Input for arcade games: determining input states. 12-188
12.2 Input for arcade games: events. 12-190
12.3 Latency. 12-191
12.4 Collisions. 12-194
12.5 The big game. 12-195
Twelfth and thirteenth weeks.
Example: the student's own game.
13 Standard I/O and file operations. 13-204
13.1 Standard I/O.. 13-204
13.2 Compiling in Visual C++. 13-205
13.3 Compiling with g++. 13-209
13.4 Treating cin and cout as files (optional) 13-210
13.5 File I/O using file names (optional) 13-216
Fourteenth week.
Examples: various programs reading/writing text files. Except for Chapter 21 (virtual functions), this and subsequent chapters use standard console I/O, not the SSDL graphics library.
This chapter likely ends the first semester, so if students are going into a class with a different textbook, they are ready for the console I/O it will certainly require them to know.
14 Character arrays and dynamic memory (pointers) 14-221
14.1 Character arrays. 14-221
14.2 Dynamic allocation of arrays. 14-224
14.3 Using the * notation. 14-228
Second semester, first week.
Examples: C's string functions, written as examples or offered as exercises; code with new and delete
15 Classes: the basics. 15-232
15.1 A simple class. 15-232
15.2 Constructors. 15-235
15.3 const objects, const member functions... 15-239
15.4 ...and const parameters. 15-241
15.5 Multiple constructors. 15-241
15.6 Default parameters for code reuse. 15-244
15.7 Date program (so far) 15-245
Second week.
Examples: the Date class; the student's own Time class.
16 Classes, continued. 16-248
16.1 inline functions for efficiency. 16-248
16.2 Access functions. 16-249
16.3 static members, and other members of the entire class (optional) 16-250
16.4 Separate compilation and include files. 16-252
16.5 Backing up a multi-file project 16-256
16.6 Separate compilation in Microsoft Visual C++. 16-257
16.7 Separate compilation in g++. 16-259
16.8 Final Date program.. 16-264
Third week.
Examples: the Date class; the student's own Time class, continued.
17 Operators, and destructors. 17-268
17.1 The basic string class -- and default arguments. 17-268
17.2 Destructors. 17-270
17.3 Binary and unary operators. 17-271
17.4 Assignment operators and *this.. 17-273
17.5 Arithmetic operators. 17-275
17.6 [] and () operators. 17-279
17.7&^> and <<: operators that aren't class members. 17-281
17.8 ++ and -- 17-283
17.9 Some fun with constructors. 17-284
17.10 ...the final String class. 17-285
17.11 #include .. 17-291
Fourth and fifth weeks.
Examples: a String class; the student's own Point or Fraction class.
18 Exceptions, recursion, and O notation. 18-292
18.1 Exceptions. 18-292
18.2 Recursion (optional) 18-300
18.3 Algorithm analysis and O-notation (optional) 18-303
Sixth week.
Examples: a Stack class; a factorial function; binary and linear search.
19 Classes, continued: inheritance. 19-309
19.1 The basics of inheritance. 19-309
19.2 Inheritance as a concept 19-312
19.3 Calling parent class constructors. 19-314
19.4 Inheritance and destructors. 19-314
19.5 protected sections. 19-314
19.6 Types of inheritance. 19-315
19.7 An inheritance hierarchy. 19-319
Seventh and eighth weeks.
Examples: card games.
20 Template functions and classes. 20-335
20.1 template functions. 20-335
20.2 The Vector class. 20-338
20.3 Making Vector a template. 20-341
20.4 Unusual class templates (optional) 20-345
20.5 #include .. 20-346
Ninth week.
Example: the Vector class
21 Multiple inheritance and virtual functions. 21-347
21.1 Multiple inheritance. 21-347
21.2 Virtual functions. 21-348
Tenth and eleventh weeks.
Example: a Shape class. This uses the SSDL library.
22 Linked lists. 22-359
22.1 What lists are, and why have them.. 22-359
22.2 T List::operator[] (int index) const; 22-363
22.3 ->: a bit of syntactic sugar 22-366
22.4 A bit more friendly syntax: pointers as conditions. 22-367
22.5 List::~List(); 22-367
22.6 The linked list class. 22-368
22.7 #include .. 22-371
Twelfth week.
Example: the List class.
23 The Standard Template Library (STL) 22-371
22.1 Iterators, and auto (C++ 11 on) 22-371
22.2 pair.. 22-375
22.3 algorithm, and functions using iterators. 22-375
22.4 Function pointers and objects. 22-376
Thirteenth week.
Example: an extension of the List class to use iterators.
This likely ends the second semester. If there is extra time, the instructor may choose to add the chapter on C, sstream, iomanip, or some other topic from remaining chapters. Otherwise, remaining chapters are extras for those who want to go further.
24 Building bigger projects. 23-377
23.1 Namespaces. 23-377
23.2 Conditional compilation. 23-378
23.3 Libraries. 23-378
25 History. 24-382
24.1 SIMULA 67. 24-382
24.2 Smalltalk. 24-382
24.3 What "object-oriented" is. 24-383
24.4 C.. 24-383
24.5 C++. 24-383
26 Esoterica (recommended) 25-385
25.1 iomanip. 25-385
25.2 Bit twiddling: &, |, and ~. 25-389
25.3 sstream: strings that are I/O streams. 25-389
25.4 Command-line arguments. 25-392
25.5 Exceptions: more detail 25-396
25.6 Template specialization. 25-399
25.7 shared_ptr (C++ 11 on) 25-400
25.8 cast operators. 25-401
25.9 Saving run time with move constructors/move = (C++ 11 on) 25-402
25.10 Multiple inheritance with virtual base classes. 25-402
27 Esoterica (not so recommended) 26-404
26.1 Microsoft Windows help. 26-404
26.2 Unix help. 26-405
26.3 friends, and why you shouldn't have any. 26-405
26.4 pImpls, iosfwd, precompiled headers, and other afflictions. 26-408
26.5 Precompiled headers. 26-411
28 C.. 27-412
27.1 Compiling C.. 27-412
27.2 #define. 27-413
27.3 stdio.h. 27-414
27.4 Parameter passing with *.. 27-421
27.5 static global declarations (optional) 27-423
Examples: programs using C's stdio functions (printf, sscanf, etc.).
29 Moving on with SDL.. 28-424
28.1 A basic program in SDL.. 28-426
Appendices
A. Setting up SDL and SSDL.. 427
B. Making your own SSDL project 429
C. Basic types. 429
D. Escape sequences. 430
E. C++ keywords. 430
F. Operators. 432
G. ASCII codes. 433
H. Standard libraries. 435
I. Common gdb commands. 438
J. SSDL reference. 440
Index 448
References. 455
Erscheinungsdatum | 16.10.2019 |
---|---|
Zusatzinfo | 187 Illustrations, black and white; XXVII, 644 p. 187 illus. |
Verlagsort | Berkley |
Sprache | englisch |
Maße | 178 x 254 mm |
Gewicht | 1259 g |
Themenwelt | Informatik ► Programmiersprachen / -werkzeuge ► C / C++ |
Informatik ► Software Entwicklung ► Spieleprogrammierung | |
Schlagworte | C++ • C++17 • Code • Computer Science • CS • Development • Game • object oriented • OO • programming • Software • source • Textbook |
ISBN-10 | 1-4842-5186-5 / 1484251865 |
ISBN-13 | 978-1-4842-5186-7 / 9781484251867 |
Zustand | Neuware |
Haben Sie eine Frage zum Produkt? |
aus dem Bereich