Electrical and Computer Engineering
32 of 37
UAH
CPE 112
The get Function versus
the Extraction Operator
•char ch1, ch2, ch3;
•Statements Contents Marker Position in
• After Input the Input Stream
• A B\n
• CD\n
•cin >> ch1; ch1 = ‘A’
•cin >> ch2; ch2 = ‘B’
•cin >> ch3; ch3 = ‘C’
• A B\n
• CD\n
•cin >> ch1; ch1 = ‘A’
•cin >> ch2; ch2 = ‘B’
•cin.get(ch3); ch3 = ‘\n’
•