Conversion from: http://hi.baidu.com/05104106/blog/item/7b7e8a77c68b5b13b151b9f2.htmlcin.get () and CIN. Getline () difference is that the former for Terminator "Do not abandon, do not give up", the latter give up. String. in H, Getline (istream, string) and CIN. getline (string, streamsize) is similar, but after a string is input, press ENTER twice under vc6, but not under Dev C ++. Cin. there are four get () parameters, ranging from 0 to 3. ch is the template type parameter: int_type get (); // get a character, can be EOF and terminatoristream & get (ch & P); // get a character to P, can be Terminator, cannot be eofistream & get (Ch * P, streamsize N ); // define the maximum input. The default Terminator is '\ n' istream & get (Ch * P, streamsize N, CH term); // redefine Terminator, it is no longer '\ n' cin. there are two Getline () parameters, from 2 to 3: istream & Getline (Ch * P, streamsize N); istream & Getline (Ch * P, streamsize N, ch term). For example, ① char ch; CIN> CH; // Achar Buf [256]; cin. Get (BUF, 256); then an error occurs, because the first time CIN> CH;, '\ n' is left in the buffer; then get (BUF, 256) terminator will be terminated immediately! Add CIN at Part. get (); or CIN. ignore (); or CIN. clear (); cin. sync (); ② while the second program (in Bjarne) will only play the first line because of CIN. get () is input immediately when '\ n' is encountered, and CIN changes to badbit: While (CIN) {cin. get (BUF, 256); cout <Buf;} ③ In the third example, you can obtain the Buf because of CIN. getline () has the discard Terminator function (discard the terminator), line B's cin. getline () will discard '\ n' After ch to make the third row input normal. Char ch; CIN> CH; cin. getline (BUF, 256); // bcin. getline (BUF, 256); cout <Buf <Endl; summary: Usually copied, using cin. getline (). Copy files by byte and use cin. Get (Ch ). Use CIN> CH; or CIN. Get (BUF, 256); in this form, the residual '\ n' ownership must be taken into account. A few more things: ostream OS (cout) is not allowed, because the stream object cannot be copied and constructed, it can only be used in ostream OS (& cout ); or the above ostream_iterator <t> OS (cout );. During input, for iostream, the integer 015 is still 15; For iostream. H, 015 is the octal 13. The two are different. Define char arr [] = "A \ xdfk \ 0123 \ 0"; Evaluate sizeof (ARR) for arr, and the result is 7. Each character is 'A', '\ xdf', 'k', '\ 012', '3', '\ 0', and' \ 0 '. The octal value is 3-digits, and the value exceeds 7. The value starts with '\'. The hexadecimal value is arbitrary-digits, and the value exceeds F, it must start with '\ x. I want to know how to implement the sizeof () algorithm? It can recognize \ 0123 and \ 0ab or even \ 0 \ 0 without using them as terminator ????? Remember, you cannot lose the first zero when expressing it in octal. Otherwise, the computer is regarded as a 10-digit system. However, when the number of octal characters is used, the value 0 cannot be used, which is the "Escape Character" expression we learned before for expressing characters. Therefore, \ 012 can be identified as the number of octal values. It is unclear what the sizeof algorithm is, based on the experiment results, it seems that, if the numbers 0 to 7 are followed, three digits can be recognized as one character at most. If there are less than three digits, the recognition will end if there are more than seven characters. For strlen (), the result is 3, ending with '\ 0. 1. Expression of the octal number C/C ++ language, How do I express an octal number? If the number is 876, we can conclude that it is not an octal number, because the octal number cannot contain more than 7 Arabic numbers. However, if the number is 123, 567, or 12345670, it is possible to set the number to octal or decimal. Therefore, C/C ++ specifies that if a number is specified to use octal, a 0 value must be added before it. For example, 123 is in decimal format, but 0123 indicates that octal is used. This is the expression of Octal numbers in C and C ++. Since neither c nor C ++ provides the expression of binary numbers, the octal we learned here is the second method of numerical expression in C and C ++. Now, for the same number, for example, 100, we can use the normal 10 hexadecimal expression in the Code, for example, when the variable is initialized: int A = 100; we can also write as follows: int A = 0144; // 0144 is 100 of the octal value; how to convert a 10-digit number into an octal value will be learned later. Remember, you cannot lose the first zero when expressing it in octal. Otherwise, the computer is regarded as a 10-digit system. However, when the number of octal characters is used, the value 0 cannot be used, which is the "Escape Character" expression we learned before for expressing characters. 2. we have learned how to use an escape character '/' in the escape character, for example, '/N' indicates line ), '/t' indicates the Tab character, and'/'indicates the single quotation mark. Today, we have learned another method to use escape characters: The Escape Character '/' is followed by an octal number to indicate characters whose ASCII code is equal to this value. For example, check the ASCII code table and find the question mark character (?) The ASCII value of is 63, so we can convert it into an octal value: 77, and then use '/77' To Represent '? '. Because it is octal, it should be written as '/077', but because C/C ++ does not allow the use of a slash plus a 10-digit number to represent characters, so here 0 can be left empty. In fact, we seldom use escape characters and Octal numbers to represent a character in actual programming. However, we need to know it later.