BEGINNING C++ THROUGH GAME PROGRAMMING, THIRD EDITION approaches learning C++ from the unique and fun perspective of games. Written for the beginning game developer or programmer, the book assumes no previous programming experience and each new skill and concept is taught using simple language and step-by-step instructions. Readers will complete small projects in each chapter to reinforce what they've learned and a final project at the end combines all of the major topics covered in the book. Featuring twenty five percent new material, this third edition covers all the latest technology and advances. Contents......Page 7 Introduction......Page 19 Introducing C++......Page 24 Creating an Executable File......Page 25 Dealing with Errors......Page 27 Introducing the Game Over Program......Page 28 Including Other Files......Page 30 Displaying Text through the Standard Output......Page 31 Terminating Statements......Page 32 Introducing the Game Over 2.0 Program......Page 33 Introducing the Game Over 3.0 Program......Page 34 Understanding When to Employ using......Page 35 Introducing the Expensive Calculator Program......Page 36 Understanding Integer and Floating Point Division......Page 37 Understanding Order of Operations......Page 38 Introducing the Game Stats Program......Page 39 Understanding Type Modifiers......Page 41 Declaring Variables......Page 42 Naming Variables......Page 43 Assigning Values to Variables......Page 44 Displaying Variable Values......Page 45 Defining New Names for Types......Page 46 Introducing the Game Stats 2.0 Program......Page 47 Using Combined Assignment Operators......Page 49 Using Increment and Decrement Operators......Page 50 Dealing with Integer Wrap Around......Page 51 Introducing the Game Stats 3.0 Program......Page 52 Using Enumerations......Page 54 Setting Up the Program......Page 55 Getting Information from the Player......Page 56 Telling the Story......Page 57 Summary......Page 58 Questions and Answers......Page 59 Exercises......Page 61 Understanding Truth......Page 62 Using the if Statement......Page 63 Introducing the Score Rater Program......Page 64 Testing true and false......Page 65 Interpreting a Value as true or false......Page 66 Nesting if Statements......Page 67 Using the else Clause......Page 68 Introducing the Score Rater 2.0 Program......Page 69 Creating Two Ways to Branch......Page 70 Using a Sequence of if Statements with else Clauses......Page 71 Introducing the Score Rater 3.0 Program......Page 72 Creating a Sequence of if Statements with else Clauses......Page 73 Using the switch Statement......Page 74 Introducing the Menu Chooser Program......Page 75 Introducing the Play Again Program......Page 77 Looping with a while Loop......Page 78 Introducing the Play Again 2.0 Program......Page 79 Looping with a do Loop......Page 80 Introducing the Finicky Counter Program......Page 81 Using the break Statement to Exit a Loop......Page 83 Introducing the Designers Network Program......Page 84 Using the Logical OR Operator......Page 88 Using the Logical NOT Operator......Page 89 Understanding Order of Operations......Page 90 Introducing the Die Roller Program......Page 91 Calling the rand() Function......Page 92 Seeding the Random Number Generator......Page 93 Calculating a Number within a Range......Page 94 Understanding the Game Loop......Page 95 Introducing Guess My Number......Page 96 Setting Up the Game......Page 97 Summary......Page 99 Questions and Answers......Page 101 Exercises......Page 103 Using for Loops......Page 104 Introducing the Counter Program......Page 105 Counting with for Loops......Page 107 Using Empty Statements in for Loops......Page 108 Nesting for Loops......Page 109 Understanding Objects......Page 110 Introducing the String Tester Program......Page 112 Creating string Objects......Page 114 Using the size() Member Function......Page 115 Iterating through string Objects......Page 116 Using the find() Member Function......Page 117 Using the erase() Member Function......Page 118 Introducing the Hero's Inventory Program......Page 119 Creating Arrays......Page 121 Indexing Arrays......Page 122 Being Aware of Array Bounds......Page 123 Understanding C-Style Strings......Page 124 Introducing the Tic-Tac-Toe Board Program......Page 126 Indexing Multidimensional Arrays......Page 128 Introducing Word Jumble......Page 129 Picking a Word to Jumble......Page 130 Jumbling the Word......Page 131 Entering the Game Loop......Page 132 Summary......Page 133 Questions and Answers......Page 134 Discussion Questions......Page 136 Exercises......Page 137 Introducing the Standard Template Library......Page 138 Using Vectors......Page 139 Introducing the Hero's Inventory 2.0 Program......Page 140 Declaring a Vector......Page 142 Using the size() Member Function......Page 143 Calling Member Functions of an Element......Page 144 Using the empty() Member Function......Page 145 Introducing the Hero's Inventory 3.0 Program......Page 146 Declaring Iterators......Page 148 Looping through a Vector......Page 149 Changing the Value of a Vector Element......Page 151 Accessing Member Functions of a Vector Element......Page 152 Using the erase() Vector Member Function......Page 153 Introducing the High Scores Program......Page 154 Preparing to Use Algorithms......Page 156 Using the random_shuffle() Algorithm......Page 157 Using the sort() Algorithm......Page 158 Examining Vector Growth......Page 159 Examining Other STL Containers......Page 161 Using Pseudocode......Page 162 Using Stepwise Refinement......Page 163 Planning the Game......Page 164 Setting Up the Program......Page 165 Entering the Main Loop......Page 166 Getting the Player's Guess......Page 167 Summary......Page 168 Questions and Answers......Page 169 Exercises......Page 171 Creating Functions......Page 174 Introducing the Instructions Program......Page 175 Declaring Functions......Page 176 Calling Functions......Page 177 Introducing the Yes or No Program......Page 178 Returning a Value......Page 180 Accepting Values into Parameters......Page 181 Understanding Encapsulation......Page 183 Introducing the Scoping Program......Page 184 Working with Separate Scopes......Page 186 Working with Nested Scopes......Page 188 Introducing the Global Reach Program......Page 189 Accessing Global Variables......Page 191 Altering Global Variables......Page 192 Using Global Constants......Page 193 Introducing the Give Me a Number Program......Page 194 Assigning Default Arguments to Parameters......Page 196 Introducing the Triple Program......Page 197 Creating Overloaded Functions......Page 199 Introducing the Taking Damage Program......Page 200 Calling Inlined Functions......Page 202 Introducing the Mad Lib Game......Page 203 The main() Function......Page 204 The askNumber() Function......Page 205 Summary......Page 206 Questions and Answers......Page 207 Exercises......Page 209 Introducing the Referencing Program......Page 210 Creating References......Page 212 Altering Referenced Values......Page 213 Introducing the Swap Program......Page 214 Passing by Value......Page 216 Passing by Reference......Page 217 Introducing the Inventory Displayer Program......Page 218 Understanding the Pitfalls of Reference Passing......Page 219 Passing a Constant Reference......Page 220 Returning References......Page 221 Introducing the Inventory Referencer Program......Page 222 Returning a Reference......Page 223 Displaying the Value of a Returned Reference......Page 224 Altering an Object through a Returned Reference......Page 225 Planning the Game......Page 226 Setting Up the Program......Page 228 The main() Function......Page 230 The askYesNo() Function......Page 231 The humanPiece() Function......Page 232 The displayBoard() Function......Page 233 The winner() Function......Page 234 The isLegal() Function......Page 235 The computerMove() Function......Page 236 Summary......Page 240 Questions and Answers......Page 241 Discussion Questions......Page 243 Exercises......Page 244 Understanding Pointer Basics......Page 246 Introducing the Pointing Program......Page 247 Declaring Pointers......Page 249 Assigning Addresses to Pointers......Page 250 Dereferencing Pointers......Page 251 Reassigning Pointers......Page 252 Using Pointers to Objects......Page 253 Using a Constant Pointer......Page 254 Using a Pointer to a Constant......Page 255 Using a Constant Pointer to a Constant......Page 256 Introducing the Swap Pointer Version Program......Page 257 Passing by Value......Page 259 Passing a Constant Pointer......Page 260 Returning Pointers......Page 261 Introducing the Inventory Pointer Program......Page 262 Returning a Pointer......Page 263 Using a Returned Pointer to Display a Value......Page 264 Assigning to a Variable the Value Pointed to by a Returned Pointer......Page 265 Altering an Object through a Returned Pointer......Page 266 Introducing the Array Passer Program......Page 267 Using an Array Name as a Constant Pointer......Page 269 Passing and Returning Arrays......Page 270 Summary......Page 271 Questions and Answers......Page 273 Exercises......Page 275 Defining New Types......Page 278 Introducing the Simple Critter Program......Page 279 Defining a Class......Page 280 Defining Member Functions......Page 281 Accessing Data Members......Page 282 Using Constructors......Page 283 Introducing the Constructor Critter Program......Page 284 Declaring and Defining a Constructor......Page 285 Calling a Constructor Automatically......Page 286 Introducing the Private Critter Program......Page 287 Specifying Public and Private Access Levels......Page 289 Defining Accessor Member Functions......Page 290 Defining Constant Member Functions......Page 291 Using Static Data Members and Member Functions......Page 292 Introducing the Static Critter Program......Page 293 Accessing Static Data Members......Page 295 Calling Static Member Functions......Page 296 Introducing the Critter Caretaker Game......Page 297 Planning the Game......Page 298 Planning the Pseudocode......Page 299 The Critter Class......Page 300 The main() Function......Page 303 Summary......Page 304 Questions and Answers......Page 306 Exercises......Page 308 Using Aggregation......Page 310 Introducing the Critter Farm Program......Page 311 Using Object Data Members......Page 313 Using Container Data Members......Page 314 Introducing the Friend Critter Program......Page 315 Overloading Operators......Page 318 Dynamically Allocating Memory......Page 319 Introducing the Heap Program......Page 320 Using the new Operator......Page 322 Using the delete Operator......Page 323 Avoiding Memory Leaks......Page 324 Introducing the Heap Data Member Program......Page 326 Declaring Data Members that Point to Values on the Heap......Page 330 Declaring and Defining Destructors......Page 331 Declaring and Defining Copy Constructors......Page 332 Overloading the Assignment Operator......Page 336 Introducing the Game Lobby Program......Page 338 The Player Class......Page 339 The Lobby Class......Page 341 The Lobby::AddPlayer() Member Function......Page 343 The Lobby::Clear() Member Function......Page 345 The operator