C + + Primer plus reading notes

Source: Internet
Author: User

Fifth cycle and relationship expressions

1.

2. Category aliases:

(1) #define Float_pointer FLOAT *

Float_pointer PA, PB; Preprocessor substitution converts the declaration into a float * pa, PB;//PA is a pointer, PB is a float

(2) typedef char BYTE does not appear above the problem is the best choice

3, Cin.get (name, arsize). Get ()//Enter a name with a length of arsize to accept line breaks

The input sent to CIN is buffered. This means that only the user presses the carriage return and the content that he enters is sent to the program so that the following characters can be followed. CIN ignores spaces and line breaks, and does not count as a space   char ch;    int cnt = 0;    CIN >> ch;    while (ch! = ' # ')    {        cout << ch;        ++cnt;        CIN >> ch;
Cin.get (CH); You can read the blanks now } cout << endl << cnt << "characters read\n";

4. Document Tail condition

After EOF is detected, CIN sets two bits (Eofbit and Failbit) to 1. The member function EOF () can be used to see if the eofbit is set, and if EOF is detected, cin.eof () returns the bool value True, and the same eofbit and Failbit are set to 1, and the fail () member function returns true

Note that the EOF () and Fail () methods report the results of the most recently read; that is, they report afterwards, not in advance.

CTRL + Z + ENTER end

while (cin.fail () = = False) {}

int ch = cin.get ()//Returns an integer with EOF at-1

Cin.get (CH)//returns TRUE or False

C + + Primer plus reading notes

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.