Ivor Horton's Beginning Visual C++ 2012
eBook - ePub

Ivor Horton's Beginning Visual C++ 2012

Ivor Horton

Share book
  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

Ivor Horton's Beginning Visual C++ 2012

Ivor Horton

Book details
Book preview
Table of contents
Citations

About This Book

The only book to teach C++ programming with Microsoft Visual Studio!

There's a reason why Ivor Horton's Beginning Visual C++ books dominate the marketplace. Ivor Horton has a loyal following who love his winning approach to teaching programming languages, and in this fully updated new edition, he repeats his successful formula. Offering a comprehensive introduction to both the standard C++ language and to Visual C++, he offers step-by-step programming exercises, examples, and solutions to deftly guide novice programmers through the ins and outs of C++ development.

  • Introduces novice programmers to the current standard, Microsoft Visual C++ 2012, as it is implemented in Microsoft Visual Studio 2012
  • Focuses on teaching both the C++11 standard and Visual C++ 2012, unlike virtually any other book on the market
  • Covers the C++ language and library and the IDE
  • Delves into new features of both the C++11 standard and of the Visual C++ 2012 programming environment
  • Features C++ project templates, code snippets, and more

Even if you have no previous programming experience, you'll soon learn how to build real-world applications using Visual C++ 2012 with this popular guide.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Ivor Horton's Beginning Visual C++ 2012 an online PDF/ePUB?
Yes, you can access Ivor Horton's Beginning Visual C++ 2012 by Ivor Horton in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione in C. We have over one million books available in our catalogue for you to explore.

Information

Publisher
Wrox
Year
2012
ISBN
9781118417034

Chapter 1
Programming with Visual C++

WHAT YOU WILL LEARN IN THIS CHAPTER:
  • What the principal components of Visual C++ are
  • What solutions and projects are and how you create them
  • About console programs
  • How to create and edit a program
  • How to compile, link, and execute C++ console programs
  • How to create and execute basic Windows programs
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
You can find the wrox.com code downloads for this chapter on the Download Code tab at www.wrox.com/remtitle.cgi?isbn=9781118368084. The code is in the Chapter 1 download and individually named according to the names throughout the chapter.

LEARNING WITH VISUAL C++

Windows programming isn’t difficult. Microsoft Visual C++ makes it remarkably easy, as you’ll see throughout the course of this book. There’s just one obstacle in your path: Before you get to the specifics of Windows programming, you have to be thoroughly familiar with the capabilities of the C++ programming language, particularly the object-oriented capabilities. Object-oriented techniques are central to the effectiveness of all the tools provided by Visual C++ for Windows programming, so it’s essential that you gain a good understanding of them. That’s exactly what this book provides.
This chapter gives you an overview of the essential concepts involved in programming applications in C++. You’ll take a rapid tour of the integrated development environment (IDE) that comes with Visual C++. The IDE is straightforward and generally intuitive in its operation, so you’ll be able to pick up most of it as you go along. The best way to get familiar with it is to work through the process of creating, compiling, and executing a simple program. So power up your PC, start Windows, load the mighty Visual C++, and begin your journey.

WRITING C++ APPLICATIONS

You have tremendous flexibility in the types of applications and program components that you can develop with Visual C++. Applications that you can develop fall into two broad categories: desktop applications and Windows 8 apps. Desktop applications are the applications that you know and love; they have an application window that typically has a menu bar and a toolbar and frequently a status bar at the bottom of the application window. This book focuses primarily on desktop applications.
Windows 8 apps are different from desktop applications. They have a user interface that is completely different from desktop applications. The focus is on the content where the user interacts directly with the data, rather than interacting with controls such as menu items and toolbar buttons.
Once you have learned C++, this book concentrates on using the Microsoft Foundation Classes (MFC) with C++ for building desktop applications. The application programming interface (API) for Windows desktop applications is referred to as Win32. Win32 has a long history and was developed long before the object-oriented programming paradigm emerged, so it has none of the object-oriented characteristics that would be expected if it were written today. The MFC consists of a set of C++ classes that encapsulate the Win32 API for user interface creation and control and greatly eases the process of program development. You are not obliged to use the MFC, though. If you want the ultimate in performance you can write your C++ code to access the Windows API directly, but it certainly won’t be as easy.
Figure 1-1 shows the basic options you have for developing C++ applications.
image
FIGURE 1-1
Figure 1-1 is a simplified representation of what is involved. Desktop applications can target Windows 7, Windows 8, or Windows Vista. Windows 8 apps execute only with Windows 8 and you must have Visual Studio 2012 installed under Windows 8 to develop them. Windows 8 apps communicate with the operating system through the Windows Runtime, WinRT. I’ll introduce you to programming Windows 8 applications in Chapter 18.

LEARNING DESKTOP APPLICATIONS PROGRAMMING

There are always two basic aspects to interactive desktop applications executing under Windows: You need code to create the graphical user interface (GUI) with which the user interacts, and you need code to process these interactions to provide the functionality of the application. Visual C++ provides you with a great deal of assistance in both aspects. As you’ll see later in this chapter, you can create a working Windows program with a GUI without writing any code at all. All the basic code to create the GUI can be generated automatically by Visual C++. Of course, it’s essential to understand how this automatically generated code works because you need to extend and modify it to make the application do what you want. To do that you need a comprehensive understanding of C++.
For this reason you’ll first learn C++ without getting involved in Windows programming considerations. After you’re comfortable with C++ you’ll learn how to develop fully fledged Windows applications. This means that while you are learning C++, you’ll be working with programs that involve only command line input and output. By sticking to this rather limited input and output capability, you’ll be able to concentrate on the specifics of how the C++ language works and avoid the inevitable complications involved in GUI building and control. Once you are comfortable with C++ you’ll find that it’s an easy and natural progression to applying C++ to the development of Windows application programs.
NOTE As I’ll explain in Chapter 18, Windows 8 apps are different. You specify the GUI in XAML, and the XAML is used to generate the C++ program code for GUI elements.

Learning C++

Visual C++ supports the C++ language defined by the most recent ISO/IEC C++ standard that was published in 2011. The standard is defined in the document ISO/IEC 14882:2011 and commonly referred to as C++ 11. The Visual C++ compiler does not support all the new language features introduced by this latest standard, just some of the most commonly used features, but it will surely be extended over time. Programs that you write in standard C++ can be ported from one system environment to another reasonably easily, although the library functions that a program uses — particularly those related to building a graphical user interface — are a major determinant of how easy or difficult it will be. ISO/IEC standard C++ is the first choice of a great many professional program developers because it is so widely supported, and because it is one of the most powerful programming languages available today.
Chapters 2 through 9 of this book teach you the C++ language and introduce some of the most commonly used C++ standard library facilities along the way. Chapter 10 explains how you can use the Standard Template Library (STL) for C++ for managing collections of data.

Console Applications

Visual C++ consol...

Table of contents