Electrical and Computer Engineering
29
of 52
UAH
CPE 112
Example Using
length
and
size
•
Example:
•
string
firstName;
•
string
fullName;
•
•
firstName = “Alexandra”;
•
cout
<< firstName.length() <<
endl
;
// Prints 9
•
fullName = firstName + “ Jones”;
•
cout
<< fullName.length() <<
endl
;
// Prints 15