A C + + program consists of one or more modules called functions. The program executes from the main () function (all lowercase), so this function is necessary. A function consists of a function head and a function body. The function header indicates the type of the function's return value (if any) and the kind of information the function expects to pass through the parameter to it. The function body consists of a series of C + + statements in curly braces ({}).
There are several types of C + + statements, including:
* Declaration statement: Defines the name and type of the variable used in the function.
* Assignment statement: Assigns a value to a variable using the copy operator (=).
* Message statement: Sends a message to an object, triggering an action.
* Function Call: Execute function. After the called function finishes executing, the program returns to the statement following the function call statement.
* Function prototype: Declares the function's return type/function to accept the number and type of arguments.
* Return statement: Returns a value from the called function to the calling function.
A class is a user-defined data type specification that describes in detail how information is represented and what operations can be performed on the data. An object is an entity created from a class specification, just as a simple variable is an entity created from a data type description.
C + + provides two predetermined objects (CIN and cout) for processing inputs and outputs, which are instances of the IStream and Ostream classes that are defined in the iostream file. The insert operator (<<) defined for the Ostream class makes it possible to insert data into the output stream, and the extraction operator (>>) defined for the IStream class can extract information from the input stream. CIN and cout are only objects that can automatically convert information from one form to another based on context.
C + + can use a large number of C library functions. To use library functions, you should include a header file that provides a prototype of the function.
C + + Primer Plus 2nd begins learning C + + learning notes