Chapter 2. Data, Variables, and Calculations
In this chapter, you'll get down to the essentials of programming in C++. By the end of the chapter you'll be able to write a simple C++ program of the traditional form: input-process-output. As I said in the previous chapter, I'll first discuss the ANSI/ISO 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.
In this chapter you will learn about:
C++ program structure
Namespaces
Variables in C++
Defining variables and constants
Basic input from the keyboard and output to the screen
Performing arithmetic calculations
Casting operands
Variable scope
The Structure of a C++ Program
Programs that will run as console applications under Visual C++ 2008 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 be console programs, either Win32 console ...
Get Ivor Horton's Beginning Visual C++®2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.