An Introduction to Numerical Methods in C++, Revised Edition

We begin with an elementary introduction to input and output in the C++ language. We go on to describe the basic data types, both integral and floating point, and the elementary types derived from these, including pointers. We end the chapter with a brief discussion of the more common preprocessor directives, and with notes on keywords and identifiers.
Throughout this book we shall need to be able to deal with input and output of character strings and numerical data. In later chapters we shall have to consider more elaborate procedures for dealing with formatted data in tabular form, and with user-defined types.
Every program, if it is to be used, must contain some output instructions, otherwise there would be no means of knowing what it had achieved. In C++, the most elementary program with output would be something like this:
#includemain( ){ cout << "This is me!\n" ;}
When compiled and run, a C++ program executes sequentially the instructions contained between braces { } in the function main. We shall introduce the concept of a C++ function more fully in the next chapter. In this case, the program will print on the screen:
This is me!
The identifier cout represents the standard output stream, usually directed to the terminal screen, and << ("insert" or "put to") represents the output operator. The program simply instructs the computer to print the...