Understanding of C + + program compilation process

Source: Internet
Author: User

When the program is compiled, all pre-processing commands are processed, replacing the specific contents of the header file with the # include command line, and then compiling the program unit as a whole.

using namespace Std; "Use command space Std".

Classes and functions in the C + + standard library are declared in the namespace STD, so if you need to use the C + + standard library in your program (you need to use the # include command line at this point)

The sum of the numbers of a and b,2?????????????

Sum of 2 numbers

#include <iostream>       //preprocessing naming
using namespace std;    //Using the namespace std
int main ()                 //main functions First
{                //Start part of the main function
   
    int a,b,sum;//define variables
    cin >> a>>b;   //Input statement,    cin input Stream object   ">>" is the extract operator, which is used in conjunction with CIN
    //role: Extracting data from input devices such as keyboards is sent to the input stream cin.
   /*
    their combination abbreviation: CIN statement. When executing the CIN statement in the program, a data input from the keyboard
    assigned to integer variable A, the second data entered is assigned to integer variable B.
    */

Sum=a+b; Assignment statements
cout<< "a+b=" <<sum<<endl; Output statement, Endl is a control, action is a newline (end line abbreviation, indicating the end of the bank)
return 0; Returns a value of 0 to the operating system if the program ends normally
/*
123 456
Result of output: a+b=579
*/
}

Understanding of C + + program compilation process

Related Article

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.