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