We already learnt about strings in C++ Data-types, Operators and Strings, but in this tutorial we are going to learn a little more about C++ strings and also see some helpful functions C++ provides for strings.
String literals are enclosed in either double quotes.
For example, "Hello World" is a string.
To type in some special characters, you have to type in a backslash escape. For example, \" is a double quote, \\ is a backslash, \t is a tab and \n is a newline. For example, the following code:
type=codeblock|id=cpp_string_escaping|autocreate=cppcout << "Alice said \"How do you do?\"\nBob replied, \"Very well thank you!\"";
Alice said "How do you do?"Bob replied, "Very well thank you!"