Chapter 2. Data, Variables, and Calculations
WHAT YOU WILL LEARN IN THIS CHAPTER:
C++ program structure
Variables in C++
Defining variables and constants
Basic input from the keyboard and output to the screen
Performing arithmetic calculations
What the auto keyword does
How to discover the type of an expression
In this chapter, you'll get down to the essentials of programming in C++. By the end of the chapter, you will be able to write a simple C++ program of the traditional form: input-process-output. I'll first discuss the ISO/IEC standard C++ language features, and then cover any additional or different aspects of the C++/CLI language.
As you explore aspects of the language using working examples, you'll have an opportunity to get some additional practice with the Visual C++ Development Environment. You should create a project for each of the examples before you build and execute them. Remember that when you are defining projects in this chapter and the following chapters through to Chapter 11, they are all console applications.
THE STRUCTURE OF A C++ PROGRAM
Programs that will run as console applications under Visual C++ 2010 are programs that read data from the command line and output the results to the command line. To avoid having to dig into the complexities of creating and managing application windows before you have enough knowledge to understand how they work, all the examples that you'll write to understand how the C++ language works will ...