C + + Primer Plus 2nd begins learning C + + learning notes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.