






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







The string class has overloaded the ==, !=, <, >, >=, <= operators to operate onthe value of the strings instead of the reference of the string (as in C) 1 string s1("hello"); 2 string s
"world"; 3 string s3, s4; 4 5 s
s
s2; 6
appends the substring from s from index
to the number 7
of characters specified by the third parameter 8
the third parameter is not an index, but a length 9 s4.append(s3,
if (s
s4)
cout
s
s
endl; 13
cout
"s
s
endl; 16 cout
"s
s
endl; 17 cout
"s
s
endl; 18 cout
"s
s
endl;
The size or length of a string is the number of characters currently stored in the string - The capacity of a string is the number of characters that can be stored in the string withouthaving to allocate more memory - The max_size of a string is the maximum number of characters allowed in a string