C++primer Note--chapter One

Source: Internet
Author: User

1. Data type

1) Basic data type: Int,char,float,double,bool

Eg:int a=1; Defines an int type object (variable) and initializes it to 1

2) Extended base data type: vector (vector), list, string (string), complex number (plural)

Eg: #include <vector> must have a header file

#include <string> must have a header file

Vector<string> Chapter_titles (20); Defines a vector object with 20 elements of a string type

2. Preprocessor Indicator

1) #include

1) shaped like <iosteam>: standard header file, search by default directory

2) shaped like "myfile.h": User-defined file, search under current directory

2) Condition Indicator: Prevents repeated processing when a header file is referenced by multiple files

Eg: #ifndef bookstore_h if not defined Bookstore.h

#define BOOKSTORE_H , then define Bookstore.h .

/* Contents of the Bookstore.h */ header file

End of #endif definition

PS: #ifndef =if not define #ifdef =if define Bookstore_h is a preprocessor constant of bookstore.h

3) Common Processor text

1) _cplusplus: According to it to determine whether the program is a C + + program

2) _stdc_: According to it to determine whether the program is a C + + program

3) _line_: The number of rows currently compiled to

4) _file_: The currently compiled file name

5) _time_: The current compile time

6) _date_: Date of the current compilation

7) Aseert (): Pre-processing macros. Execution continues when the preconditions in parentheses are met, otherwise an error message is displayed and terminated.

(C:assert.h C++:cassert)

This article is from the "Momo echnical honor" blog, please be sure to keep this source http://momo462.blog.51cto.com/10138434/1738058

C++primer Note--chapter One

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.