C++ Without Fear: A Beginner's Guide That Makes You Feel Smart

Learning C++ Doesn’t Have to Be Difficult!

 

Have you ever wanted to learn programming? Have you ever wanted to learn the C++ language behind many of today’s hottest games, business programs, and even advanced spacecraft? C++ Without Fear, Third Edition, is the ideal way to get started. Now updated for the newest C++14 standard and the free Microsoft Visual C++ Community Edition, it will quickly make you productive with C++ even if you’ve never written a line of code!

 

Brian Overland has earned rave reviews for this book’s approach to teaching C++. He starts with short, simple examples you can easily enter and run. Within a couple of chapters, you’ll be creating useful utilities, playing games, and solving puzzles. Everything’s simplified to its essentials, patiently explained, and clearly illustrated with practical examples and exercises that help you make progress quickly.

 

Overland reveals the “whys” and “tricks” behind each C++ language feature. And you’ll never get bogged down in complex or pointless examples: He keeps you 100% focused on learning what works and what matters—while having fun!

 

This new and improved edition

  • Covers installing and using the free Microsoft Visual C++ Community Edition— but you can use any version of C++
  • Explains valuable improvements in the new C++14 standard
  • Modularizes C++14 coverage so it’s easy to write code that works with older versions
  • Teaches with even more puzzles, games, and relevant exercises
  • Offers more “why” and “how-to” coverage of object orientation, today’s #1 approach to programming
  • Presents more ways to use Standard Template Library (STL) code to save time and get more done
  • Contains an expanded reference section for all your day-to-day programming

Whether you want to learn C++ programming for pleasure or you’re considering a career in programming, this book is an outstanding choice.

1124173931
C++ Without Fear: A Beginner's Guide That Makes You Feel Smart

Learning C++ Doesn’t Have to Be Difficult!

 

Have you ever wanted to learn programming? Have you ever wanted to learn the C++ language behind many of today’s hottest games, business programs, and even advanced spacecraft? C++ Without Fear, Third Edition, is the ideal way to get started. Now updated for the newest C++14 standard and the free Microsoft Visual C++ Community Edition, it will quickly make you productive with C++ even if you’ve never written a line of code!

 

Brian Overland has earned rave reviews for this book’s approach to teaching C++. He starts with short, simple examples you can easily enter and run. Within a couple of chapters, you’ll be creating useful utilities, playing games, and solving puzzles. Everything’s simplified to its essentials, patiently explained, and clearly illustrated with practical examples and exercises that help you make progress quickly.

 

Overland reveals the “whys” and “tricks” behind each C++ language feature. And you’ll never get bogged down in complex or pointless examples: He keeps you 100% focused on learning what works and what matters—while having fun!

 

This new and improved edition

  • Covers installing and using the free Microsoft Visual C++ Community Edition— but you can use any version of C++
  • Explains valuable improvements in the new C++14 standard
  • Modularizes C++14 coverage so it’s easy to write code that works with older versions
  • Teaches with even more puzzles, games, and relevant exercises
  • Offers more “why” and “how-to” coverage of object orientation, today’s #1 approach to programming
  • Presents more ways to use Standard Template Library (STL) code to save time and get more done
  • Contains an expanded reference section for all your day-to-day programming

Whether you want to learn C++ programming for pleasure or you’re considering a career in programming, this book is an outstanding choice.

33.99 In Stock
C++ Without Fear: A Beginner's Guide That Makes You Feel Smart

C++ Without Fear: A Beginner's Guide That Makes You Feel Smart

by Brian Overland
C++ Without Fear: A Beginner's Guide That Makes You Feel Smart

C++ Without Fear: A Beginner's Guide That Makes You Feel Smart

by Brian Overland

eBook

$33.99 

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

Learning C++ Doesn’t Have to Be Difficult!

 

Have you ever wanted to learn programming? Have you ever wanted to learn the C++ language behind many of today’s hottest games, business programs, and even advanced spacecraft? C++ Without Fear, Third Edition, is the ideal way to get started. Now updated for the newest C++14 standard and the free Microsoft Visual C++ Community Edition, it will quickly make you productive with C++ even if you’ve never written a line of code!

 

Brian Overland has earned rave reviews for this book’s approach to teaching C++. He starts with short, simple examples you can easily enter and run. Within a couple of chapters, you’ll be creating useful utilities, playing games, and solving puzzles. Everything’s simplified to its essentials, patiently explained, and clearly illustrated with practical examples and exercises that help you make progress quickly.

 

Overland reveals the “whys” and “tricks” behind each C++ language feature. And you’ll never get bogged down in complex or pointless examples: He keeps you 100% focused on learning what works and what matters—while having fun!

 

This new and improved edition

  • Covers installing and using the free Microsoft Visual C++ Community Edition— but you can use any version of C++
  • Explains valuable improvements in the new C++14 standard
  • Modularizes C++14 coverage so it’s easy to write code that works with older versions
  • Teaches with even more puzzles, games, and relevant exercises
  • Offers more “why” and “how-to” coverage of object orientation, today’s #1 approach to programming
  • Presents more ways to use Standard Template Library (STL) code to save time and get more done
  • Contains an expanded reference section for all your day-to-day programming

Whether you want to learn C++ programming for pleasure or you’re considering a career in programming, this book is an outstanding choice.


Product Details

ISBN-13: 9780134318998
Publisher: Pearson Education
Publication date: 11/27/2015
Sold by: Barnes & Noble
Format: eBook
Pages: 624
File size: 29 MB
Note: This product may take a few minutes to download.
Age Range: 18 Years

About the Author

Brian Overland published his first article in a professional math journal at age 14.

 

After graduating from Yale, he began working on large commercial projects in C and Basic, including an irrigation-control system used all over the world. He also tutored students in math, computer programming, and writing, as well as lecturing to classes at Microsoft and at the community-college level. On the side, he found an outlet for his lifelong love of writing by publishing film and drama reviews in local newspapers. His qualifications as an author of technical books are nearly unique because they involve so much real programming and teaching experience, as well as writing.

 

In his 10 years at Microsoft, he was a tester, author, programmer, and manager. As a technical writer, he became an expert on advanced utilities, such as the linker and assembler, and was the “go-to” guy for writing about new technology. His biggest achievement was probably organizing the entire documentation set for Visual Basic 1.0 and having a leading role in teaching the “object-based” way of programming that was so new at the time. He was also a member of the Visual C++ 1.0 team.

 

Since then, he has been involved with the formation of new start-up companies (sometimes as CEO). He is currently working on a novel.

Read an Excerpt

In my ten years at Microsoft, I found the top-level programmers ("software development engineers," we called them) to be an interesting breed. Once you got them to open up and talk about their projects, they could be an articulate and passionate group.

The trick was to get beyond the initial barrier, to convince them that you spoke their language. Experienced programmers sometimes divide the world into two groups: those who are "technical" and those who are not. At times a yawning gap seems to exist between them, like that between people with perfect pitch and those without.

For programmers, the dividing line these days is most often the ability to program in C++. This attitude stems from the perception of C++ as difficult to learn.

This book is dedicated to the idea that C++ need not be difficult. It's often a more challenging language than Basic, to be sure, but with the right kind of help,you can master the tricks of C++.Why a New C++ Book?

Introductory programming books for C++ exist aplenty. But many—probably the great majority—are "introductory" only in the sense that they don't assume knowledge of C++ specifically. They usually assume that you've programmed in another language before, preferably in several.

This book does not make that assumption. All that's required is that you're comfortable with a computer and that you've run applications such as a word processor or e-mail reader.

Once you narrow the available C++ texts down to those that require no programming experience at all, there's a much smaller group of books from which to choose.What Else Is New about This Book?

The book you hold in your hand stresses the fundamentals ofprogramming. Yet even if you have programmed before (maybe you've taken a basic course in high school or college), you may find this a useful review. This book delves into thetopic of how to think like a programmer . . . and why specific language features matter. The why is as important as the how.

People learn best when they get the benefit of several learning methods reinforcing one another. Therefore, every topic in this book is introduced by a general discussion with short program-code examples, accompanied by the following:

  • A complete program example. Usually I provide a complete example that can be run and tested. The emphasis in this book is on short examples that do something interesting and useful and, when possible, something fun.
  • Programming exercises. Each example has a series of accompanying exercises, in which I encourage you to modify the example or write similar programs, so that from the beginning you're writing C++ code. Answers to these exercises provided on the accompanying CD in the folder "Example Code and Answers to Exercises."
  • Generous use of illustrations. Many so-called beginning texts don't use this approach at all. But I often find that the right figures can clarify an abstract concept. One picture is worth a thousand lectures, sometimes.
  • A special "How It Works" section for every major example in the book. How-to program texts are notorious for giving you a long example followed by a couple of paragraphs of text. That's not the approach of this book. Complete examples are listed so that you can see everything in context. But after each example, I go back and dissect the program a couple of lines at a time, explaining how and why each bit of the program does what it does.
Multiple Learning Paths: What Fits You Best

In addition to the multiple learning techniques just described, this book contains frequent Interludes, where the more curious reader will find additional background and explanations why C++ features work the way they do. If you're eager to just get C++ programs working, you may want to skip the Interludes and return to them later. One of the advantages of this book is that it accommodates multiple learning paths.

Unlike some texts, this book does not start with an exhaustive description of all language features such as data types, control structures, and operators. That would be like learning French by spending months memorizing nouns ratherthan learning to speak a complete sentence. This book focuses on getting real programs to work, right away.

At the same time, it's helpful to have access to a thorough-but-concise summary of language features. This book provides that summary in a series of convenient appendixes.What If You Already Have a Programming Background?

If you already know another programming language but are new to C++, that's not a problem. Certain ideas in programming never get old: what it means to think like a programmer, what's going on just beneath the surface, why the language is constructed the way it is. This review of programming fundamentals may be of interest anyway. But if not, you can speed through the first chapter or two. C++ gets challenging quickly enough.What Is Not Covered?

The goal of this book is to make you comfortable and conversant in C++, including objected-oriented programming features (classes and objects) that, although a relatively advanced topic, are at the heart of C++. The goal is not to teach every last bit of language syntax or to describe how every statement is translated into machine behavior (that is, how it is implemented), although in some places I do discuss that.

In my view, the good majority of beginning texts make the mistake of trying to cover every obscure corner of the language, even though there is ample room in intermediate to advanced books to handle those topics.

In case you are a C++ expert or otherwise a guru perusing this book, or you have some familiarity with the scope of the language, here is a summary of what's in C++ but is not covered in this book. (Consider this a "truth in advertising"disclaimer.)

  • Bit fields and bit operations. Bit operations can occasionally be useful for programs that must make extreme use of compact space, but in general, bit operations are rarely necessary. This is a good advanced topic. Likewise, I don't cover the union keyword (another feature used for compaction).
  • Windows and GUI programming. These are difficult subjects, deserving of their own book (or three). Visual C++ requires understanding of a complex architecture and thorough knowledge of object-oriented programming systems (OOPS). Reading this book first will give you a background in OOPS.
  • Templates and STL (Standard Template Library). This is another good topic for an advanced book. A template is a way of creating a generalized data structure in which an abstract mechanism can be combined with any number of specific data types. The template-defining capability was not originally in the C++ specification, although it is now standard.

Although this book does cover exception handling—a way to respond to runtime errors—I don't stress it, because it is most appropriate in complex programsand not likely to be as useful to a beginner.Why Should Anyone Start with C++?

Some people will tell you that C++ is unsuitable for beginners; therefore, unless you're in the elite of talented and experienced programmers, you shouldn't bother. I don't agree with that.

There are some good reasons for learning C++ early in your programming career. People used to spend a lot of time mastering the C language first. Yet C is rarely used for real work anymore. Now students learn it primarily as a stepping-stone to C++. But this makes little sense. You can pick up some bad habits learning C. It's better to go directly to C++. C++ is now the language of choice for systems programmers as well as for writing commercial software—including games, graphics, and business-oriented programs.

Some other languages (notably Microsoft's Visual Basic) are more forgiving. But as with C, Basic can encourage bad habits. C++ offers any learner some unique rewards.

  • Like the C language, C++ is a systems-programming language. In learning about C++ (at least in this book) you'll learn a lot about how things work in the computer and why they do.
  • Unlike C, C++ is a good implementation of object-oriented programming. This is an approach to programming in which you create intelligent data structures, especially well suited to things such as graphics programming. Object-oriented programming also lets you define new types that in effect expand the capabilities of the language itself. In learning object-oriented programming, you'll learn more about the current state of software design and where it's going.

The first half of this book focuses on the fundamentals of C++: how to get a program to work and accomplish basic tasks. From the beginning, however, it does get you to start using and understanding objects.

The second half focuses more completely on object-oriented programming, with special emphasis on how you can use it to write useful—and reusable—program code.To Get Started . . .

This book provides an added bonus: an accompanying CD with a free compiler, which is the language translator needed to write and execute programs in C++. All the programming examples in this book have been tested and retested with this compiler. The examples also work with compilers such as C++ in Microsoft Visual Studio.NET, although you'll need to follow the special instructions in Chapter 1 for use with that environment.

To install the free C++ compiler, just insert the CD into a PC and follow the instructions in the README.TXT file in the root directory.

This compiler is a free shareware version of GNU C++. You are free to use it to build and distribute your own programs. It also comes with a free development environment, so (as described in Chapter 1), you can write programs and then build them (translate them into executable form) at the touch of a single keystroke.Tips and Tricks: What Do I Watch Out For?

Perhaps what gives C-based languages their reputation for being more difficult than some others is that they have some "gotchas"—things that will catch you offguard if you don't have a friendly mentor standing next to you to steer you around the pitfalls.

As much as anything, this book is about keeping you safe from the gotchas. For too many people, the ability to program is gained only after making the same unnecessary mistakes over and over.

Above all, I hope to communicate some of what makes the subject, at least at times, so interesting. Software development can test your patience as you track down elusive bugs. But the concepts can be fascinating. In our new century, programming computers has become the new kind of craftsmanship, the new mode of fashioning fine tools, for a world that runs on information.

Table of Contents

Preface xxiii

Acknowledgments xxix

About the Author xxxi

 

Chapter 1: Start Using C++ 1

Install Microsoft Visual Studio 1

Create a Project with Microsoft 2

Writing a Program in Microsoft Visual Studio 5

Running a Program in Visual Studio 5

Compatibility Issue #1: stdafx.h 6

Compatibility Issue #2: Pausing the Screen 8

If You’re Not Using Microsoft 8

Advancing to the Next Print Line 12

Storing Data: C++ Variables 16

Introduction to Data Types 17

A Word about Variable Names and Keywords 26

Chapter 1 Summary 27

 

Chapter 2: Decisions, Decisions 29

But First, a Few Words about Data Types 29

Decision Making in Programs 31

Introducing Loops 39

True and False in C++ 46

The Increment Operator (++) 48

Statements versus Expressions 49

Introducing Boolean (Short-Circuit) Logic 51

Introducing the Math Library 55

Chapter 2 Summary 62

 

Chapter 3: And Even More Decisions! 65

The do-while Loop 65

Introducing Random Numbers 69

The switch-case Statement 77

Chapter 3 Summary 83

 

Chapter 4: The Handy, All-Purpose “for” Statement 85

Loops Used for Counting 85

Introducing the “for” Loop 86

A Wealth of Examples 88

Declaring Loop Variables “On the Fly” 92

Comparative Languages 101: The Basic “For” Statement 96

Chapter 4 Summary 97

 

Chapter 5: Functions: Many Are Called 99

The Concept of Function 99

The Basics of Using Functions 101

Local and Global Variables 109

Recursive Functions 112

Games and More Games 129

Chapter 5 Summary 131

 

Chapter 6: Arrays: All in a Row... 133

A First Look at C++ Arrays 133

Initializing Arrays 135

Zero-Based Indexing 135

Strings and Arrays of Strings 144

2-D Arrays: Into the Matrix 152

Chapter 6 Summary 153

 

Chapter 7: Pointers: Data by Location 155

What the Heck Is a Pointer, Anyway? 155

The Concept of Pointer 156

Declaring and Using Pointers 158

Data Flow in Functions 165

Swap: Another Function Using Pointers 165

Reference Arguments (&) 172

Pointer Arithmetic 173

Pointers and Array Processing 175

Chapter 7 Summary 180

 

Chapter 8: Strings: Analyzing the Text 181

Text Storage on the Computer 181

It Don’t Mean a Thing if It Ain’t Got that String 183

String-Manipulation Functions 184

Reading String Input 190

Individual Characters versus Strings 197

The C++ String Class 201

Other Operations on the string Type 209

Chapter 8 Summary 210

 

Chapter 9: Files: Electronic Storage 213

Introducing File—Stream Objects 213

Text Files versus “Binary” Files 222

Introducing Binary Operations 225

Chapter 9 Summary 233

 

Chapter 10: Classes and Objects 237

OOP, My Code Is Showing 237

What’s an Object, Anyway? 238

Point: A Simple Class 241

Private: Members Only (Protecting the Data) 243

Introducing the Fraction Class 248

Inline Functions 251

Find the Greatest Common Factor 253

Find the Lowest Common Denominator 254

Chapter 10 Summary 267

 

Chapter 11: Constructors: If You Build It… 269

Introducing Constructors 269

Multiple Constructors (Overloading) 270

C++11/C++14 Only: Initializing Members 271

The Default Constructor—and a Warning 272

C++11/C++14 Only: Delegating Constructors 274

Reference Variables and Arguments (&) 281

The Copy Constructor 282

A Constructor from String to Fract 285

Chapter 11 Summary 286

 

Chapter 12: Two Complete OOP Examples 289

Dynamic Object Creation 289

Other Uses of new and delete 290

Blowin’ in the Wind: A Binary Tree App 291

The Bnode Class 294

The Btree Class 296

Tower of Hanoi, Animated 302

Chapter 12 Summary 311

 

Chapter 13: Easy Programming with STL 313

Introducing the List Template 313

Designing an RPN Calculator 323

Correct Interpretation of Angle Brackets 333

Chapter 13 Summary 333

 

Chapter 14: Object-Oriented Monty Hall 335

What’s the Deal? 335

TV Programming: “Good Deal, Bad Deal” 337

The Monty Hall Paradox, or What’s Behind the Door? 351

Improving the Prize Manager 353

Chapter 14 Summary 356

 

Chapter 15: Object-Oriented Poker 359

Winning in Vegas 359

How to Draw Cards 361

The Card Class 363

The Deck Class 364

Doing the Job with Algorithms 366

The Vector Template 371

Getting Nums from the Player 372

How to Evaluate Poker Hands 378

Chapter 15 Summary 387

 

Chapter 16: Polymorphic Poker 389

Multiple Decks 389

Switching Decks at Runtime 391

Polymorphism Is the Answer 392

“Pure Virtual” and Other Abstract Matters 401

Abstract Classes and Interfaces 402

Object Orientation and I/O 403

A Final Word (or Two) 410

An (Even More) Final Word 411

Chapter 16 Summary 412

 

Chapter 17: New Features of C++14 415

The Newest C++14 Features 415

Features Introduced in C++11 422

The long long Type 422

Range-Based “for” (For Each) 433

The auto and decltype Keywords 438

The nullptr Keyword 439

Strongly Typed Enumerations 440

Raw-String Literals 443

Chapter 17 Summary 444

 

Chapter 18: Operator Functions: Doing It with Class 447

Introducing Operator Functions 447

Operator Functions as Global Functions 450

Improve Efficiency with References 452

Working with Other Types 463

The Class Assignment Function (=) 463

The Test-for-Equality Function (==) 465

A Class “Print” Function 466

A Really Final Word (about Ops) 471

Chapter 18 Summary 472

 

Appendix A: Operators 475

The Scope (::) Operator 478

The sizeof Operator 478

Old- and New-Style Type Casts 479

Integer versus Floating-Point Division 480

Bitwise Operators (&, |, &hat;, ~, <<, and >>) 480

Conditional Operator 481

Assignment Operators 482

Join (,) Operator 482

 

Appendix B: Data Types 483

Precision of Data Types 484

Data Types of Numeric Literals 485

String Literals and Escape Sequences 486

Two’s-Complement Format for Signed Integers 487

 

Appendix C: Syntax Summary 491

Basic Expression Syntax 491

Basic Statement Syntax 492

Control Structures and Branch Statements 493

Variable Declarations 498

Function Declarations 500

Class Declarations 502

Enum Declarations 503

 

Appendix D: Preprocessor Directives 505

The #define Directive 505

The ## Operator (Concatenation) 507

The defined Function 507

The #elif Directive 507

The #endif Directive 508

The #error Directive 508

The #if Directive 508

The #ifdef Directive 509

The #ifndef Directive 510

The #include Directive 510

The #line Directive 511

The #undef Directive 511

Predefined Constants 512

 

Appendix E: ASCII Codes 513

 

Appendix F: Standard Library Functions 517

String (C-String) Functions 517

Data-Conversion Functions 518

Single-Character Functions 519

Math Functions 520

Randomization Functions 521

Time Functions 521

Formats for the strftime Function 523

 

Appendix G: I/O Stream Objects and Classes 525

Console Stream Objects 525

I/O Stream Manipulators 526

Input Stream Functions 528

Output Stream Functions 528

File I/O Functions 529

 

Appendix H: STL Classes and Objects 531

The STL String Class 531

The <bitset> Template 533

The <list> Template 534

The <vector> Template 536

The <stack> Template 538

 

Appendix I: Glossary of Terms 541

 

Index 559

From the B&N Reads Blog

Customer Reviews