1. Because the string literal is not the same type as the standard library string type for compatibility with C language;
2. In the following code, CIN has a few points to note: A. Read and Ignore all whitespace characters (such as spaces, line breaks, tabs) that begin with; B. read characters until you encounter whitespace characters again, read terminate
int main () { string s; Cin >> S; return 0; }
One of the 3.string IO operations is getline, terminating the condition is to encounter a newline character, even if the first character is a newline, it indicates that STIRNG read the null characters
int main () { string line; while (Getline (CIN, line)) { cout << line << Endl; } return 0;}
4. Any variable that stores the result of a size operation of string must be of type String::size_type, do not assign the return value of size to the int variable, there is String::size_ The main reason for type types is that the size of string is not affected by the machine;
5. The maximum number of characters a string can have to be stored, directly looking at its size type;
6. It is recommended to use the String::size_type type when manipulating a string object using an index;
7. The operation function of the character, usually is stored in the Cctype header file, the following list some functions:
true if C is a control character
| isalnum (c) |
if C is a letter or Number, true |
| isalpha (c) |
True if C is a letter |
| Iscntrl (c) |
| isdigit (c) |
If C is a number, true |
| isgraph (c) |
If C is not a space but printable, true |
| islower (c) |
True if C is a lowercase letter |
| isprint (c) |
True if C is a printable character |
| ispunct (c) |
if C is a punctuation mark, true |
| isspace (c) |
True if C is a white space character |
| Isupper (c) |
True if C is an uppercase letter |
| Isxdigit (c) |
True if C is a hexadecimal number |
| ToLower (c) |
If C is an uppercase letter, return its lowercase letters, or return directly to C |
| ToUpper (c) |
if C is a lowercase letter, return its uppercase form, or return directly to C |
The 8.c++ standard library also contains the C standard library, such as the C language Ctype.h standard library functions, in C + + is removed. h, preceded by C, indicating that the header file comes from the C language standard library, is # include <cctype> and belongs to the Std namespace;
9.const_iterator This type of intelligence is used to read elements in a container, but cannot modify its value, such as vector<string>::const_iterator iter = Test.begin ();
10. Two iterator variable subtraction, iter1-iter2, resulting in a type of Difference_type signed type value;
The 11.bitset object is mainly used for the operation of Bits,bitset<16> BITVEC1, the object has 16 bits, the whole site is 0;
"Reading Notes" C++primer---chapter III