Skip to main content

Ivor Horton's Beginning Visual C++ 2013

Ivor Horton's Beginning Visual C++ 2013

Ivor Horton

ISBN: 978-1-118-84577-6

Apr 2014

960 pages

$38.99

Description

Learn C++ with the best tutorial on the market!

Horton's unique tutorial approach and step-by-step guidance have helped over 100,000 novice programmers learn C++. In Ivor Horton's Beginning Visual C++ 2013, Horton not only guides you through the fundamentals of the standard C++ language, but also teaches you how C++ is used in the latest Visual Studio 2013 environment. Visual Studio 2013 includes major changes to the IDE and expanded options for C++ coding. Ivor Horton's Beginning Visual C++ 2013 will teach you the latest techniques to take your Visual C++ coding to an all-new level.

  • C++ language and library changes supported under Visual Studio 2013
  • IDE-specific changes for code formatting and debugging
  • Changes to the C++ Standard Language for both C++ 11 and the new C++ 14
  • And more

Horton introduces you to both Standard C++ and Visual C++ so you can build any component your app requires. Ivor Horton's Beginning Visual C++ 2013 is an indispensable guidebook for any new programmer, and contains plenty of exercises and solutions to help programmers of any level master the important concepts quickly and easily.

Related Resources

Instructor

Request an Evaluation Copy for this title

Introduction xxxiii

Chapter 1: Programming with Visual C++ 1

Learning with Visual C++ 1

Writing C++ Applications 2

Learning Desktop Applications Programming 3

The Integrated Development Environment 6

Using the IDE 8

Summary 23

Chapter 2: Data, Variables, and Calculations 25

The Structure of a C++ Program 26

Defining Variables 38

Fundamental Data Types 40

Basic Input/Output Operations 47

Calculating in C++ 52

Type Conversion and Casting 63

The auto Keyword 65

Discovering Types 66

The Bitwise Operators 67

Introducing Lvalues and Rvalues 72

Understanding Storage Duration and Scope 72

Variables with Specific Sets of Values 79

Namespaces 83

Summary 86

Chapter 3: Decisions and Loops 91

Repeating a Block of Statements 109

Summary 127

Chapter 4: Arrays, Strings, and Pointers 129

Handling Multiple Data Values of the Same Type 129

Working with C-Style Strings 140

Indirect Data Access 146

Dynamic Memory Allocation 163

Using References 168

Library Functions for Strings 171

Summary 176

Chapter 5: Introducing Structure into Your Programs 179

Understanding Functions 179

Passing Arguments to a Function 188

Returning Values from a Function 206

Returning a Pointer 206

Recursive Function Calls 214

Summary 217

Chapter 6: More about Program Structure 221

Pointers to Functions 221

Initializing Function Parameters 228

Exceptions 229

Handling Memory Allocation Errors 235

Function Overloading 237

Function Templates 241

Using the decltype Operator 244

An Example Using Functions 246

Summary 264

Chapter 7: Defining Your Own Data Types 267

The struct in C++ 267

Types, Objects, Classes, and Instances 276

Understanding Classes 279

Class Constructors 287

Private Members of a Class 297

The Pointer this 304

Const Objects 306

Arrays of Objects 309

Static Members of a Class 310

Pointers and References to Objects 314

Summary 318

Chapter 8: More on Classes 323

Class Destructors 324

Implementing a Copy Constructor 329

Operator Overloading 331

The Object Copying Problem 351

Default Class Members 361

Class Templates 362

Perfect Forwarding 373

Default Arguments for Template Parameters 376

Aliases for Class Templates 381

Template Specialization 382

Using Classes 385

Organizing Your Program Code 403

Library Classes for Strings 405

Summary 427

Chapter 9: Class Inheritance and Virtual Functions 431

Object-Oriented Programming Basics 432

Inheritance in Classes 433

Access Control Under Inheritance 437

The Copy Constructor in a Derived Class 447

Preventing Class Derivation 450

Class Members as Friends 451

Virtual Functions 453

Casting Between Class Types 470

Summary 475

Chapter 10: The Standard Template Library 479

What Is the Standard Template Library? 479

Smart Pointers 485

Algorithms 488

Function Objects in the STL 489

Function Adapters 490

The Range of STL Containers 490

Sequence Containers 490

Associative Containers 543

More on Iterators 556

More on Function Objects 562

More on Algorithms 564

Type Traits and Static Assertions 566

Lambda Expressions 567

Summary 577

Chapter 11: Windows Programming Concepts 579

Windows Programming Basics 580

The Structure of a Windows Program 586

The Microsoft Foundation Classes 605

Summary 610

Chapter 12: Windows Programming with the Microsoft Foundation Classes (MF C) 613

The MFC Document/View Concept 614

Creating MFC Applications 618

Summary 635

Chapter 13: Working with Menus and Toolbars 637

Communicating with Windows 637

Extending the Sketcher Program 642

Elements of a Menu 643

Adding Menu Message Handlers 646

Adding Toolbar Buttons 656

Summary 660

Chapter 14: Drawing in a Window 663

Basics of Drawing in a Window 663

The MFC Drawing Mechanism 667

Drawing Graphics in Practice 678

Programming for the Mouse 680

Drawing a Sketch 709

Summary 713

Chapter 15: Improving the View 717

Sketcher Limitations 717

Improving the View 718

Deleting and Moving Elements 726

Implementing a Context Menu 726

Identifying an Element Under the Cursor 730

Dealing with Masked Elements 743

Summary 745

Chapter 16: Working with Dialogs and Controls 747

Understanding Dialogs 748

Understanding Controls 748

Creating a Dialog Resource 749

Programming for a Dialog 751

Supporting the Dialog Controls 755

Completing Dialog Operations 758

Using a Spin Button Control 763

Using the Scale Factor 769

Working with Status Bars 775

The CString Class 779

Using an Edit Box Control 780

Summary 790

Chapter 17: Storing and Printing Documents 793

Understanding Serialization 793

Applying Serialization 801

Exercising Serialization 809

Printing a Document 811

Implementing Multipage Printing 815

Summary 825

Chapter 18: Programming for Windows 8 827

Windows Store Applications 828

Developing Windows Store Apps 829

Windows Runtime Concepts 829

C++ Component Extensions (C++/CX) 831

The Extensible Application Markup Language (XAML) 836

Creating a Windows Store App 844

Scaling UI Elements 873

Transitions 875

Summary 879

Index 881

Chapter 4 Code Download
Chapter 18 Code Download
Chapter 15 Code Download
Chapter 12 Code Download
Chapter 6 Code Download
Chapter 17 Code Download
Chapter 1 Code Download
Chapter 3 Exercise Solutions Download
Chapter 15 Exercise Solutions Download
ReadMe Text Download
Chapter 10 Code Download
Chapter 8 Code Download
Chapter 5 Code Download
Chapter 4 Exercise Solutions Download
Chapter 2 Code Download
Corrected image 4.3 Download
Chapter 7 Exercise Solutions Download
Chapter 5 Exercise Solutions Download
Chapter 2 Exercise Solutions Download
Chapter 14 Code Download
Chapter 13 Code Download
Chapter 10 Exercise Solutions Download
Chapter 9 Code Download
Chapter 8 Exercise Solutions Download
Chapter 6 Exercise Solutions Download
Chapter 17 Exercise Solutions Download
Chapter 14 Exercise Solutions Download
Chapter 13 Exercise Solutions Download
Chapter 3 Code Download
Chapter 16 Exercise Solutions Download
Chapter 16 Code Download
Chapter 11 Code Download
Chapter 9 Exercise Solutions Download
Chapter 7 Code Download
Corrected image 4.2 Download
237Error in Text,Currently reads:
Defining the _UNICODE symbol causes the Windows header files to assume Unicode characters are the default. Defining _UNICODE does the same for the C runtime header files that come with the C++ standard library.
Should be:
Defining the UNICODE symbol causes the Windows header files to assume Unicode characters are the default. Defining _UNICODE does the same for the C runtime header files that come with the C++ standard library.
3 June 2015
262Error in Text,(Sentence under the table)
Currently Reads:
There are also const_cast, static_cast, dynamic_cast, reinterpret_cast, and typeid that are not included in the table because they are never ambiguous.
Should Read:
The const_cast, static_cast, dynamic_cast, reinterpret_cast,and type_id are included in the table but they are never ambiguous.
30 June 2015
268Text Correction,Figure 2-8:
CURRENTLY reads:
result: 0x01 0 0 0 0 0 0 0 0
Should read:
result: 0x01 0 0 0 0 0 0 0 1
12/19/14
270Text Correction: Error in Code,Bottom line, page 70, figure 2-10:
Should Read:
00010...
(with all digits further to the right as '0')
12/4/14
282Error in Code,(at the end of the Try It Out section) Currently Reads:
suit value: 0
Add 10 to another: 11
Sky color value: 4
Incremented sky color: 14
Should Read:
suit value: 0
Add 10 to another: 11

Sky color value: 4
Incremented sky color: 14
30 June 2015
3104Error in Code, Try it Out section right before How It Works
Currently Reads:
The output from this program is:
We have 1 cake.
We have 2 cakes.
Should Read:
The output from this program is:
We have 1 cake.
We have 2 cakes.

16 July 2015
4136Error in Text,(second sentence in the first paragraph after the code)
Currently Reads:
The compiler knows that the array elements are of type double, so t will be of type double.
Should Read:
The compiler knows that the array elements are of type double, so temperature will be of type double.
5 June 2015
137Figure error,... The arrangement of this array is illustrated in Figure 4-2. But Figure 4-2 describes syntax for cin.getline() example. Figure 4-2 is wrong. 05/01/15
4141Figure error ,Figures 4-2 and 4-3 have been swapped10/19/2015
5186Error in Code,(the output to the code in the Try it Out section)
Currently Reads:
5.0 cubed = 125
3.0 cubed = 27
x = 81
Should read:
5.0 cubed = 125
3.0 cubed = 27
x= power(3.0, power(2.0, 2.0));
16 July 2015
5186Error in Code, 2nd line of code at the top of the page
Currently Reads:
double x {1};                                      // Different x from that in function power Should Read:
double x {3}; // Different x from that in function power
3/Aug/2015
5185Error in Code,185 last 2 lines of code on the page
Currently reads:
int main()
{
Should read:
int main(void)
{
16 July 2015
207Text Correction: Error in Code,Currently Reads:
double num {5.0}; // Test value double* ptr {}; // Pointer to returned value ptr = treble(num); out << endl << Three times num = << 3.0*num; Should Read:
double num {5.0}; // Test value double* ptr {}; // Pointer to returned value ptr = treble(num); cout << endl << Three times num = << 3.0*num;
12/19/14
210Text Correction: Error in Code,Currently Reads:
int len {_countof(data)}
Should Read:
int len {_countof(data)};
12/19/14
Error in Print,Listing for Ex8_11.cpp produces error C2797 in Visual Studio 2013 Update 3. Prior to Update 3 this was OK. What is the fix for this please?05/01/15
6252Error in Code,5th line of code
Currently Reads:
int index {};                         // Keeps track of current character position Should read:
size_t index {}; //Keeps track of current character position

3/Aug/2015
6255Error in Code,half way through code block at the bottom of the page
Currently Reads:
char message [31] { Invalid character in number: }
Should read:
char message [31] { Invalid character in number: };
3/Aug/2015
301Text Correction: Error in Code,4th line from top of page
Currently Reads:
Box(double lv, double wv, double hv) : Should Read:
CBox(double lv, double wv, double hv) :
12/19/14
368Text Correction: Error in Code,Currently Reads:
moreBoxes.aAdd(CBox { 5.0, 4.0, 6.0 });
Should Read:
moreBoxes.add(CBox { 5.0, 4.0, 6.0 });
12/19/14
8375Error in Code,Currently Reads:
Creating Person{string{ Ivor } , string{ Horton }} - rvalue arguments:
Rvalue Name constructor.
Rvalue Name constructor.
Person is Ivor Horton
Creating Person{first , second} - lvalue arguments:
Lvalue Name constructor.
Lvalue Name constructor.
Person is Fred Fernackerpan
Creating Person{first , string{ Bloggs }} - lvalue, rvalue arguments:
Lvalue Name constructor.
Rvalue Name constructor.
Person is Fred Bloggs
Creating Person{ Richard , Horton } - rvalue const char* arguments:
Rvalue Name constructor.
Rvalue Name constructor.
Person is Richard Horton

Should Read:
Creating Person{string{ Ivor } , string{ Horton }} - rvalue arguments:
Rvalue Name constructor.
Rvalue Name constructor.
Person is Ivor Horton
Creating Person{first , second} - lvalue arguments:
Lvalue Name constructor.
Lvalue Name constructor.
Person is Fred Fernackerpan
Creating Person{first , string{ Bloggs }} - lvalue, rvalue arguments:
Lvalue Name constructor.
Rvalue Name constructor.
Person is Fred Bloggs
Creating Person{ Richard , Horton } - rvalue const char* arguments:
Rvalue Name constructor.
Rvalue Name constructor.
Person is Richard Horton

19-Aug -2015
8376Error in Code,Currently Reads:
Creating Person{string{ Ivor } , string{ Horton }} - rvalue arguments:
Rvalue Name constructor.
Rvalue Name constructor.
Person is Ivor Horton
Creating Person{first , second} - lvalue arguments:
Lvalue Name constructor.
Lvalue Name constructor.
Person is Fred Fernackerpan
Creating Person{first , string{ Bloggs }} - lvalue, rvalue arguments:
Lvalue Name constructor.
Rvalue Name constructor.
Person is Fred Bloggs
Creating Person{ Richard , Horton } - rvalue const char* arguments:
Rvalue Name constructor.
Rvalue Name constructor.
Person is Richard Horton

Should Read:
Creating Person{string{ Ivor } , string{ Horton }} - rvalue arguments:
Rvalue Name constructor.
Rvalue Name constructor.
Person is Ivor Horton
Creating Person{first , second} - lvalue arguments:
Lvalue Name constructor.
Lvalue Name constructor.
Person is Fred Fernackerpan
Creating Person{first , string{ Bloggs }} - lvalue, rvalue arguments:
Lvalue Name constructor.
Rvalue Name constructor.
Person is Fred Bloggs
Creating Person{ Richard , Horton } - rvalue const char* arguments:
Rvalue Name constructor.
Rvalue Name constructor.
Person is Richard Horton

19-Aug -2015
8395Error in Code,Currently reads:
Using std::rel_ops::operator<=;
Should be:
using std::rel_ops::operator<=;

19-Aug -2015
398Text Correction: Error in Code,Currently Reads:
double volume () @@@remove MG OK IH@@@) const
should be:
double volume () const
12/19/14
8408Error in Code,On pg 408 in the Try it Out Ex8_14.cpp:
Currently Reads:
std::getline(cin, firstname, '\n');
Should be
std::getline(std::cin, firstname, '\n')

19-Aug -2015
8409Error in Code,
Currently Reads:
Enter a first name or press Enter to end: Marilyn
Enter a second name: Munroe
Enter Marilyn's age: 26
Enter a first name or press Enter to end: Tom
Enter a second name: Crews
Enter Tom's age: 45
Enter a first name or press Enter to end: Arnold
Enter a second name: Weisseneggar
Enter Arnold's age: 52
Enter a first name or press Enter to end:
The names you entered are:
Marilyn Munroe aged 26.
Tom Crews aged 45.
Arnold Weisseneggar aged 52.
Done!!

Should be
Enter a first name or press Enter to end: Marilyn
Enter a second name: Munroe
Enter Marilyn's age: 26
Enter a first name or press Enter to end: Tom
Enter a second name: Crews
Enter Tom's age: 45
Enter a first name or press Enter to end: Arnold
Enter a second name: Weisseneggar
Enter Arnold's age: 52
Enter a first name or press Enter to end:
The names you entered are:
Marilyn Munroe aged 26.
Tom Crews aged 45.
Arnold Weisseneggar aged 52.
Done!!

19-Aug -2015
508Text Correction: Error in Code,Currently reads:
std::sort(stdbegin(people), stdend(people);
should read:
std::sort(std::begin(people), std::end(people);
01/07/14
62Errata in Text,After the current row 7, a row line 8 should be inserted as follows (where | indicate columns and are not characters in the table) :

8 | < <= > >= | Left

The remaining existing rows 8-17 should be renumbered as 9-18
11-Dec-15