String Operators#
There are a lot of operators and functions that can work on strings. See https://en.cppreference.com/w/cpp/string/basic_string.html
We can concatenate strings using the + operator:
#include <iostream>
#include <string>
int main() {
std::string a{"this is a test"};
std::string b{"of concatenation"};
std::cout << a + " " + b << std::endl;
}
Note
This is an example of operator overloading, a core concept of object-oriented languages like C++.