* String class: 1.cin>> string, stop when '\ n' or space is encountered, and' \ n' or space remains in the input, that is, read-only a word or nothing, but the string class handles empty characters or something. the next read will jump.
Line breaks and spaces;
2. getline (cin, string) can be used to read a row into a string. This function continues to read until '\ n' is encountered. Note that getline () is not a class method of cin, cin indicates here to find the input. and this function reads '\ n' and discards it.
Not in string.
* Char arr []: 1.cin>> arr is always read, which is not safe. when '\ n' or space is encountered, it is stopped and' \ 0' is automatically added to the backend, but '\ n' or space remains in the input. the next read will also skip line breaks and spaces;
2. Read a row with cin. getline (arr, length) and add '\ 0' to the end to specify the length. read' \ n' and discard it.
* Char: 1.cin>> char skips '\ n' or spaces until it does not.
2. cin. get (char) can read every character, including line breaks and spaces. char = cin. get.
* Read a row from a file to string: note that the string header file must be included. This is easy to error. getline (ifstream, string); getline is just a function here.