Electrical and Computer Engineering
34 of 37
UAH
CPE 112
Reading String Data
•The extraction operator can be used but not with any strings which have blanks embedded in them. (it stops reading when it encounters a whitespace)
•There’s a function we can use: getline.
•It stops when it reaches a newline character. (the newline character is consumed)
–Example: getline(cin, myString);