Computer learning
Computer learning
Strings
String
Series of characters treated as single unit
Can include letters, digits, special characters +, -, * …
In c++ String object used like any other built-in data type
In C++ String is treated as another container class
For using the string class must include <string>
String class includes
Constructors
Member function
operators
Strings
String(const string & str) - for creating string object from other
string object
String Class Functions
>> input
Creating (String) objects
We can easily modify the contents of string objects in several ways, such as
insert(), replace(), erase() and append().
Ex:
S1 = 12345
S2 = abcde